-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
120 lines (89 loc) · 3.38 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
const Discord = require('discord.js');
const bot = new Discord.Client();
const { token } = require('./config.json');
const { readdirSync, read } = require('fs');
const { join } = require('path');
const { channel } = require('diagnostics_channel');
bot.commands = new Discord.Collection();
const prefix = '$';
//this prefix can be what ever you want ;)
const commandFiles = readdirSync(join(__dirname, "commands")).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(join(__dirname, "commands", `${file}`));
bot.commands.set(command.name, command);
}
bot.on("error", console.error);
//Custom Status---------------------------------------------------------------------------------------------------------------Custom Status
bot.on('ready', () => {
console.log('Bot is Online!');
const activities = [
"",
"Go check out our Merch!",
"",
"Watching Bitcoin.",
""
];
bot.on("ready", () => {
// run every 10 seconds
setInterval(() => {
// generate random number between 1 and list length.
const randomIndex = Math.floor(Math.random() * (activities.length - 1) + 1);
const newActivity = activities[randomIndex];
bot.user.setActivity(newActivity);
}, 10000);
});
})
const activities = [
"",
"Go check out our Merch!",
"Description HERE",
"Watching Bitcoin.",
""
];
bot.on("ready", () => {
// run every 10 seconds
setInterval(() => {
// generate random number between 1 and list length.
const randomIndex = Math.floor(Math.random() * (activities.length - 1) + 1);
const newActivity = activities[randomIndex];
bot.user.setActivity(newActivity);
}, 10000);
});
//Custom Status----------------------------------------------------------------------------------------------------------------Custom Status
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === 'dm') return;
if(message.content.startsWith(prefix)) {
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if(!bot.commands.has(command)) return;
try {
bot.commands.get(command).run(bot, message, args);
} catch (error){
console.error(error);
}
}
})
bot.on('guidCreate', (guild) => {
let channeltoSend;
guild.channels.cache.forEach((channel) => {
if (
channel.type === "text" &&
!channeltoSend &&
channel.permissionsFor(guild.me).has("SEND_MESSAGES")
) channeltoSend = channel;
});
if(!channeltoSend) return;
let channelEmbed = new Discord.MessageEmbed()
.setColor("WHITE")
.setAuthor(`Hello! Thank you for invting me to your server!`)
.setDescription("Prefix is: $")
.addField("Need help?", "Contact the creator StanTheMan#6969 or type $help")
channeltoSend.send(channelEmbed).catch(e => {
if (e) {
return;
}});
})
//--------------------------------------------------------------------------------------------------------------------------------------------\\
//music here code
bot.login(token);