generated from Khanmanan/automod-bot
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
227 lines (166 loc) · 6.47 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
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
"$TOEKN"
// if you need help ask in the help channel dont dm me
const { default_prefix } = require("./config.json")
const fetch = require("node-fetch");
const db =require("quick.db");
const moment = require("moment");
const { CanvasSenpai } = require("canvas-senpai")
const canva = new CanvasSenpai();
const { emotes , emoji} =require("./config.json")
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.queue = new Map()
process.on('unhandledRejection', console.error);
client.on("message", async message => {
if (message.author.bot) return;
if (!message.guild) return;
if (!message.content.startsWith(default_prefix)) return;
if (!message.member)
message.member = 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://cdn.discordapp.com/attachments/815889737750544405/827575020338675822/welcome_imgae.png",blur: false })
const attachment = new discord.MessageAttachment(
data,
"welcome-image.png"
);
client.channels.cache.get(chx).send(`Welcome to ${member.guild.name}, Server ${member.user}\nYou are our ${member.guild.memberCount}th Member. Enjoy `, attachment);
});
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=cwkhan`)
.then(res => res.json())
.then(data => {
message.channel.send(`> ${message.content} \n <@${message.author.id}> ${data.message}`);
});
message.channel.stopTyping();
}
});
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");
const manager = new GiveawaysManager(client, {
storage: "./handlers/giveaways.json",
updateCountdownEvery: 10000,
default: {
botsCanWin: false,
exemptPermissions: [ "MANAGE_MESSAGES", "ADMINISTRATOR" ],
embedColor: "#FF0000",
reaction: "🎉"
}
});
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("ready", () => {
client.user.setStatus("online");
console.log("automodv12 beta is ready join support server https://dsc.gg/kmdevs")
});
require('http').createServer((req, res) => res.end('AutomodBot is alive! Join support server https;//dsc.gg/cwkhan')).listen(3000)
client.on
client.on("ready", () => {
client.user.setActivity("qhelp|Made By cwkhan ", { type: "PLAYING"})
})
const { Player } = require("discord-music-player");
const player = new Player(client, {
leaveOnEmpty: false,
});
client.player = player;
new Player(client, {
leaveOnEnd: true,
leaveOnStop: true,
leaveOnEmpty: true,
timeout: 10,
volume: 150,
quality: 'high',
});
const fs = require('fs')
client.on('guildCreate', guild =>{
const channelId = '841994461126197248'; //put your channel ID here
const channel = client.channels.cache.get(channelId);
if(!channel) return; //If the channel is invalid it returns
const embed = new discord.MessageEmbed()
.setTitle('I Joined A Guild!')
.setDescription(`**Guild Name:** ${guild.name} (${guild.id})\n**Members:** ${guild.memberCount}`)
.setTimestamp()
.setColor('RANDOM')
.setFooter(`I'm in ${client.guilds.cache.size} Guilds Now!`);
channel.send(embed);
});
client.on('guildDelete', guild =>{
const channelId = '841994754399928341';//add your channel ID
const channel = client.channels.cache.get(channelId); //This Gets That Channel
if(!channel) return; //If the channel is invalid it returns
const embed = new discord.MessageEmbed()
.setTitle('I Left A Guild!')
.setDescription(`**Guild Name:** ${guild.name} (${guild.id})\n**Members:** ${guild.memberCount}`)
.setTimestamp()
.setColor('RED')
.setFooter(`I'm in ${client.guilds.cache.size} Guilds Now!`);
channel.send(embed);
});
console.log("Subscribe on yt cwkhan")
const smartestchatbot = require('smartestchatbot')
const scb = new smartestchatbot.Client()
client.on("message", async message => {
if (message.channel.name == "abotchat") {
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.");
scb.chat({message: message.content, name: client.user.username, owner:"cwkhan", user: message.author.id, language:"auto"}).then(reply => {
message.inlineReply(`${reply}`);
})
message.channel.stopTyping();
}
});
require("./ExtendedMessage");
allowedMentions: {
// set repliedUser value to `false` to turn off the mention by default
repliedUser: true
}
client.login(process.env.TOKEN);