blob: abbb40a28c464e8423cdc995184b4aa464e273ea (
plain) (
blame)
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
|
const Discord = require('discord.js');
const config = require('./config.json');
const bot = new Discord.Client();
const isImageUrl = require('is-image-url');
const emoji = require('emoji-random');
const atquotes = require('at-quotes');
const ytdl = require('ytdl-core');
bot.on('ready', () => {
console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console
bot.user.setActivity('psycho~ uwu', { // Set status
type: 'LISTENING'
});
// Outputs available commands in output console
//commands = ['bot', 'help'];
//console.log(commands);
});
// Outputs errors in console window
bot.on('error', console.error);
// Start Bot Commands
bot.on('message', async msg => {
//console.log(msg.content.toLowerCase());
if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) {
var msgContent = msg.content.toLowerCase();
if (prefixCheck()) {
console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name);
}
//console.log(config.prefixes.main);
// Check prefixies in config.json
function prefixCheck() {
if (msgContent.startsWith(config.prefixes.main)) {
return "main";
} else if (msgContent.startsWith(config.prefixes.alt)) {
return "alt1";
} else if (msgContent.startsWith(config.prefixes.alt2)) {
return "alt2";
} else if (msgContent.startsWith(config.prefixes.alt3)) {
return "alt3";
} else if (msgContent.startsWith(config.prefixes.alt4)) {
return "alt4";
} else if (msgContent.startsWith(config.prefixes.alt5)) {
return "alt5";
} else if (msgContent.startsWith(config.prefixes.alt6)) {
return "alt6";
} else if (msgContent.startsWith(config.prefixes.alt6b)) {
return "alt6b";
}
}
if (prefixCheck() == "main") {
var args = msg.content.slice(config.prefixes.main.length).split(/ +/);
var command = args.shift().toLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return;
} else if (prefixCheck() == "alt1") {
var args = msg.content.slice(config.prefixes.alt.length).split(/ +/);
var command = args.shift().toLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return;
} else if (prefixCheck() == "alt2") {
var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/);
var command = args.shift().toLocaleLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return;
} else if (prefixCheck() == "alt3") {
var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/);
var command = args.shift().toLocaleLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return;
} else if (prefixCheck() == "alt4") {
var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/);
var command = args.shift().toLocaleLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return;
} else if (prefixCheck() == "alt5") {
var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/);
var command = args.shift().toLocaleLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return;
} else if (prefixCheck() == "alt6") {
var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/);
var command = args.shift().toLocaleLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return;
} else if (prefixCheck() == "alt6b") {
var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/);
var command = args.shift().toLocaleLowerCase();
if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return;
}
function noArgs() {
msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`);
}
function noCommand() {
msg.channel.send(`invalid or unspecified command. type \`${config.prefixes.main}help\`.`);
}
function perms(p) {
if (msg.member.hasPermission(p)) return true;
}
/*if (command == 'botstatus' || command == 'status' || command == 'bs') {
if (msg.member.hasPermission('KICK_MEMBERS')) {
if (!args) {
msg.reply('no status specified')
}
if (args == 'online') {
bot.user.setStatus("online");
} else if (args == 'idle') {
bot.user.setStatus("idle");
} else if (args == 'dnd') {
bot.user.setStatus("dnd");
} else if (args == 'invisable') {
bot.user.setStatus("invisable");
}
} else {
msg.reply('insufficent perms bruh');
}
}*/
/*function joinCheck() {
switch (msg.guild.voiceConnection) {
case !msg.guild.voiceConnection && msg.member.voiceChannel:
msg.member.voiceChannel.join();
msg.reply('succesfully joined voice channel')
case (msg.guild.voiceConnection):
msg.reply('i\'m already in voice channel')
case (!msg.member.voiceChannel):
msg.reply('you\'re not in a voice channel')
}
}*/
} else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return;
})
// Get bot token
bot.login(config['secret'])
|