This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons.js
212 lines (186 loc) · 8.22 KB
/
buttons.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
const config = require("./config.json");
const token = require("./token.json");
const Discord = require("discord.js");
const fs = require("fs");
var gifit = require('gifit');
const { MessageActionRow, MessageButton,MessageAttachment,Intents,Client} = require('discord.js');
var intent = Intents.resolve(4095);
const { DiscordTogether } = require('discord-together');
const buttonresponce = require("./buttons");
//var Youtube = require("ytdl-core");
module.exports.buttonresponce = async function(client,interaction)
{
const guild =interaction.guild;
const member = interaction.guild.members.cache.get(interaction.member.user.id);
const voiceChannel = member.voice.channel;
switch(interaction.customID)
{
/*
case "help1":
await interaction.deferReply();
await interaction.editReply({embeds:[embed1], components: [row]});
break;
case "help2":
await interaction.deferReply();
await interaction.editReply({embeds:[embed2], components: [row]});
break;
case "help3":
await interaction.deferReply();
await interaction.editReply({embeds:[embed3], components: [row]});
break;
case "help4":
await interaction.deferReply();
await interaction.editReply({embeds:[embed4], components: [row]});
break;
case "help5":
await interaction.deferReply();
await interaction.editReply({embeds:[embed5], components: [row]});
break;
*/
case "youtube":
await interaction.deferReply();
if(member.voice.channel){
client.discordTogether.createTogetherCode(member.voice.channel.id, 'youtube').then(async invite => {
await interaction.editReply(`${invite.code}`);
});
break;
}
case "poker":
await interaction.deferReply();
if(member.voice.channel){
client.discordTogether.createTogetherCode(member.voice.channel.id, 'poker').then(async invite => {
await interaction.editReply(`${invite.code}`);
});
}
else{
await interaction.deferReply();
interaction.channel.send(`<@${member.id}> your not in an voice channel`).then(msg => {
setTimeout(() => msg.delete(), 1000)
})
break;
}
case "chess":
await interaction.deferReply();
if(member.voice.channel){
client.discordTogether.createTogetherCode(member.voice.channel.id, 'chess').then(async invite => {
await interaction.editReply(`${invite.code}`);
});
break;
}
else{
await interaction.deferReply();
interaction.channel.send(`<@${member.id}> your not in an voice channel`).then(msg => {
setTimeout(() => msg.delete(), 1000)
})
break;
}
case "betrayal":
await interaction.deferReply();
if(member.voice.channel){
client.discordTogether.createTogetherCode(member.voice.channel.id, 'betrayal').then(async invite => {
await interaction.editReply(`${invite.code}`);
});
}
else{
interaction.channel.send(`<@${member.id}> your not in an voice channel`).then(msg => {
setTimeout(() => msg.delete(), 1000)
})
}
break;
case "fishing":
await interaction.deferReply();
if(member.voice.channel){
client.discordTogether.createTogetherCode(member.voice.channel.id, 'fishing').then(async invite => {
await interaction.editReply(`${invite.code}`);
});
}
else{
interaction.channel.send(`<@${member.id}> your not in an voice channel`).then(msg => {
setTimeout(() => msg.delete(), 1000)
})
}
break;
case "delmsg":
await interaction.deferReply();
interaction.message.delete();
break;
case "ban":
await interaction.deferReply();
var filter = m => interaction.guild.members.resolve(m.author.id).permissions.has("BAN_MEMBERS");
interaction.editReply(`Please mention an member to ban(If you have ban permisisons)`, { components: [] });
interaction.message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
})
.then(message => {
message = message.first()
if(interaction.guild.members.resolve(message.author.id).permissions.has("BAN_MEMBERS")){
var user = message.mentions.members.first();
interaction.guild.members.ban(user.id,{reason: `${message.author.id}|${message.content}`});
interaction.message.reply(`<@${user.id}> has been Banned by <@${message.author.id}>`)
}
})
.catch(collected => {
interaction.channel.send('Timeout');
});
break;
case "lockchannel":
await interaction.deferReply();
if(interaction.guild.members.resolve(interaction.user.id).permissions.has("ADMINISTRATOR")){
await interaction.editReply(`⚠Initializing Channel Lockdown⚠`);
interaction.message.reply("Please Hold by While we get things fixed on our end");
interaction.message.channel.editReplyOverwrite(interaction.message.channel.guild.roles.everyone, { VIEW_CHANNEL: false, SEND_MESSAGES: false });
}
break;
case "ytdl":
/*
var filter = m => interaction.guild.members.resolve(m.author.id).permissions.has("EMBED_FILES");
interaction.editReply(`Please send an youtube link and I will make u an mp4 if u have File permissions`, { components: [] });
await interaction.message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
})
.then(async message => {
message = message.first()
if(interaction.guild.members.resolve(message.author.id).permissions.has("EMBED_FILES")){
// var user = message.mentions.members.first();
var video = Youtube(message.cleanContent);
console.log(message.cleanContent)
interaction.message.reply(`Generating`)
var fname = `./tmp/${message.author.id}_${Date.now()}`;
await video.pipe(fs.createWriteStream(fname+'.mp4'));
await message.channel.send(`<@${message.author.id}> here is your mp4`,{ files: [fs.createReadStream(fname+'.mp4')] } );
await message.delete();
}
})
.catch(collected => {
interaction.channel.send('Timeout');
});
*/
interaction.editReply("Feature Disabled!")
break;
case "kick":
await interaction.deferReply();
var filter = m => interaction.guild.members.resolve(m.author.id).permissions.has("KICK_MEMBERS");
interaction.editReply(`Please mention an member to kick(If you have ban permisisons)`, { components: [] });
interaction.message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
})
.then(message => {
message = message.first()
if(interaction.guild.members.resolve(message.author.id).permissions.has("KICK_MEMBERS")){
var user = message.mentions.members.first();
interaction.guild.members.kick(user.id,{reason: `${message.author.id}|${message.content}`});
interaction.message.reply(`<@${user.id}> has been Kicked by <@${message.author.id}>`)
}
})
.catch(collected => {
interaction.channel.send('Timeout');
});
break;
}
}