-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
124 lines (105 loc) · 4.68 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
require("dotenv").config();
const { Client } = require("discord.js");
const Discord = require("discord.js");
const fetch = require("node-fetch");
const fs = require("fs");
const client = new Client();
const PREFIX = "c!";
const ACTIVITIES = {
"poker": {
id: "755827207812677713",
name: "Poker Night"
},
"betrayal": {
id: "773336526917861400",
name: "Betrayal.io"
},
"youtube": {
id: "755600276941176913",
name: "YouTube Together"
},
"fishington": {
id: "814288819477020702",
name: "Fishington.io"
}
};
client.on('ready', async () => {
client.appInfo = await client.fetchApplication();
setInterval( async () => {
client.appInfo = await client.fetchApplication();
}, 1);
client.user.setActivity(`Amogus ❤️ Github By NoMiK`, { type:'WATCHING' })
});
const log = message => {
console.log(` ${message}`);
};
client.on("ready", () => console.log("Bot Aktif | NoMiK (nrmezqx)"));
client.on("warn", console.warn);
client.on("error", console.error);
client.on("message", async message => {
if (message.author.bot || !message.guild) return;
if (message.content.indexOf(PREFIX) !== 0) return;
const args = message.content.slice(PREFIX.length).trim().split(" ");
const cmd = args.shift().toLowerCase();
if (cmd === "ping") return message.channel.send(`Pong! \`${client.ws.ping}ms\``);
if (cmd === "yttogether") {
const channel = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]);
if (!channel || channel.type !== "voice") return message.channel.send("Geçersiz kanal belirtildi!");
if (!channel.permissionsFor(message.guild.me).has("CREATE_INSTANT_INVITE")) return message.channel.send("CREATE_INSTANT_INVITE iznine ihtiyacım var");
fetch(`https://discord.com/api/v8/channels/${channel.id}/invites`, {
method: "POST",
body: JSON.stringify({
max_age: 86400,
max_uses: 9,
target_application_id: "830427926482255902", // youtube together
target_type: 2,
temporary: false,
validate: null
}),
headers: {
"Authorization": `Bot ${client.token}`,
"Content-Type": "application/json"
}
})
.then(res => res.json())
.then(invite => {
if (invite.error || !invite.code) return message.channel.send("YouTube başlatılamadı!");
message.channel.send(`**Yayını** Başlatmak İçin Tıklayın! ${channel.name}: <https://discord.gg/${invite.code}>`);
})
.catch(e => {
message.channel.send("**Yayın** başlatılamadı!");
})
}
// or use this
if (cmd === "oynat") {
const channel = message.guild.channels.cache.get(args[0]);
if (!channel || channel.type !== "voice") return message.channel.send("**Şu Şekillerde Kullanın; \n**-------------------------------------** \n c!oynat KanalİD youtube | Youtube Üzerinden Video Oynatırsınız! \n c!oynat KanalİD poker | Poker Oyunu Oynarsınız! \n c!oynat KanalİD betrayal | Betrayal Oyunu Oynarsınız! \n c!oynat KanalİD fishington | Fishington Oyunu Oynarsınız!**");
if (!channel.permissionsFor(message.guild.me).has("CREATE_INSTANT_INVITE")) return message.channel.send("CREATE_INSTANT_INVITE iznine ihtiyacım var");
const activity = ACTIVITIES[args[1] ? args[1].toLowerCase() : null];
if (!activity) return message.channel.send(`Doğru formatlar: \n${Object.keys(ACTIVITIES).map(m => `- **${PREFIX}activity <Channel_ID> ${m}**`).join("\n")}`);
fetch(`https://discord.com/api/v8/channels/${channel.id}/invites`, {
method: "POST",
body: JSON.stringify({
max_age: 86400,
max_uses: 9,
target_application_id: activity.id,
target_type: 2,
temporary: false,
validate: null
}),
headers: {
"Authorization": `Bot ${client.token}`,
"Content-Type": "application/json"
}
})
.then(res => res.json())
.then(invite => {
if (invite.error || !invite.code) return message.channel.send(`Başlatılamadı **${activity.name}**!`);
message.channel.send(`Başlatmak İçin Buraya Tıklayın! **${activity.name}** **${channel.name}**: <https://discord.gg/${invite.code}>`);
})
.catch(e => {
message.channel.send(`Başlatılamadı **${activity.name}**!`);
})
}
});
client.login("token");