-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
241 lines (149 loc) · 5.6 KB
/
server.js
File metadata and controls
241 lines (149 loc) · 5.6 KB
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
const { default_prefix } = require("./config.json");
const { config } = require("dotenv");
const fetch = require("node-fetch");
const db =require("quick.db");
const moment = require("moment");
const { CanvasSenpai } = require("canvas-senpai")
const canva = new CanvasSenpai();
const discord = require("discord.js");
const client = new discord.Client({
disableEveryone: false
});
const yts = require('yt-search')
client.queue = new Map();
client.vote = new Map();
const { ready } = require("./handlers/ready.js")
client.commands = new discord.Collection();
client.aliases = new discord.Collection();
["command"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
client.on("message", async message => {
const prefixMention = new RegExp(`^<@!?${client.user.id}>( |)$`);
if (message.content.match(prefixMention)) {
return message.reply(`My prefix is \`${default_prefix}\``);
}
if (message.author.bot) return;
if (!message.guild) return;
if (!message.content.startsWith(default_prefix)) return;
if (!message.member)
message.member = await message.guild.fetchMember(message);
const args = message.content
.slice(default_prefix.length)
.trim()
.split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
let command = client.commands.get(cmd);
if (!command) command = client.commands.get(client.aliases.get(cmd));
if (command) command.run(client, message, args);
});
client.on("guildMemberAdd", async member => {
let chx = db.get(`welchannel_${member.guild.id}`);
if (chx === null) {
return;
}
let data = await canva.welcome(member, { link: "https://i.pinimg.com/originals/f3/1c/39/f31c39d56512dc8fbf30f9d0fb3ee9d3.jpg" })
const attachment = new discord.MessageAttachment(
data,
"welcome-image.png"
);
client.channels.cache.get(chx).send("Welcome to our Server " + member.user.username, attachment);
});
//ctabot
client.on("message", async message => {
if (message.channel.name == "chatbot") {
if (message.author.bot) return;
message.content = message.content.replace(/@(everyone)/gi, "everyone").replace(/@(here)/gi, "here");
if (message.content.includes(`@`)) {
return message.channel.send(`**:x: Please dont mention anyone**`);
}
message.channel.startTyping();
if (!message.content) return message.channel.send("Please say something.");
fetch(`https://api.affiliateplus.xyz/api/chatbot?message=${encodeURIComponent(message.content)}&botname=${client.user.username}&ownername=KHANMANAN#1000`)
.then(res => res.json())
.then(data => {
message.channel.send(`> ${message.content} \n <@${message.author.id}> ${data.message}`);
});
message.channel.stopTyping();
}
});
//LEVEL
const { addexp } = require("./handlers/xp.js")
//LEVEL
client.on("message", async message => {
if(message.author.bot) return;
if(!message.guild) return;
return addexp(message)
})
client.snipes = new Map()
client.on('messageDelete', function(message, channel){
client.snipes.set(message.channel.id, {
content:message.content,
author:message.author.tag,
image:message.attachments.first() ? message.attachments.first().proxyURL : null
})
})
const { GiveawaysManager } = require("discord-giveaways");
// Starts updating currents giveaways
const manager = new GiveawaysManager(client, {
storage: "./handlers/giveaways.json",
updateCountdownEvery: 10000,
default: {
botsCanWin: false,
exemptPermissions: [ "MANAGE_MESSAGES", "ADMINISTRATOR" ],
embedColor: "#FF0000",
reaction: "🎉"
}
});
// We now have a giveawaysManager property to access the manager everywhere!
client.giveawaysManager = manager;
client.on("message", async message => {
if(!message.guild) return;
let prefix = db.get(`default_prefix${message.guild.id}`)
if(prefix === null) prefix =default_prefix;
if(!message.content.startsWith(default_prefix)) return;
})
client.on("guildCreate", guild => {
const { MessageEmbed } = require("discord.js");
const ID = "821627997520920616";
const channel = client.channels.cache.get(ID);
const sowner = guild.owner.user;
if (!channel) return;
const embed = new MessageEmbed()
.setTitle("**I Joined a Server!**")
.addField(`**SERVER NAME**`, `\`\`\`${guild.name}\`\`\``)
.addField(`**SERVER ID**`, `\`\`\`${guild.id}\`\`\``)
.addField(`**SERVER OWNER**`, `\`\`\`${sowner.tag}\`\`\``)
.addField(`**OWNER ID**`, `\`\`\`${sowner.id}\`\`\``)
.addField(`**CREATED ON**`, `\`\`\`${guild.createdAt}\`\`\``)
.addField(`**MEMBERS**`, `\`\`\`${guild.memberCount}\`\`\``)
.setTimestamp()
.setColor("32CD32")
.setFooter(`Servers Count - ${client.guilds.cache.size}`);
channel.send(embed);
});
// Set the bot's online/idle/dnd/invisible status
client.on("ready", () => {
client.user.setStatus("online");
console.log("automodv12 beta is ready join support server https://dsc.gg/kmdevs")
});
client.on("message", async message => {
if(!message.guild) return;
let prefix = db.get(`prefix_${message.guild.id}`)
if(prefix === null) prefix = default_prefix;
if(!message.content.startsWith(prefix)) return;
})
client.on('voiceStateUpdate', (old, New) => {
if(old.id !== client.user.id) return
if(old.channelID && !New.channelID) client.queue.delete(old.guild.id)
})
client.on('ready', () => {
var channel = client.channels.cache.get('812592647876247579');
if (channel) channel.join();
});
client.on
client.on("ready", () => {
client.user.setActivity(`qhelp |Servers Count - ${client.guilds.cache.size}`, { type: "WATCHING"})
})
client.login(process.env.TOKEN);