-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
85 lines (72 loc) · 2.35 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
const Discord = require('discord.js');
const fs = require('fs');
const client = new Discord.Client();
const prefixes = ['.'];
const descriptions = ['.help - hopefully you figured this one out.'
, '.ping - for if you want to check that the bot works.'
, '.owo - an especially egregious owoizer.'
, '.stiles - a gift, from me to you.'
, '.github - Gigabitten/froggo if you don\'t care about the details.'
];
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setPresence({ game: { name: "frogger || .help" }});
});
client.on('message', msg => {
trigger = msg.content;
trigger = parse(trigger);
author = msg.author;
const chan = msg.channel;
if(prefixes.includes(trigger.charAt(0)) && !author.bot) {
processed = trigger.substr(1).split(' ');
if(processed[0] === 'ping') ping(author, chan);
else if(processed[0] === 'help') help(chan);
else if(processed[0] === 'github') git(chan);
else if(processed[0] === 'owo') owo(processed, chan);
else if(processed[0] === 'stiles') stiles(chan);
else chan.send("Sorry, I don't recognize that command!");
}
});
function stiles(chan) {
const embed = new Discord.RichEmbed()
.setImage('https://i.imgur.com/Eh6cKRK.gif');
chan.send({embed});
}
function owo(words, chan) {
if(words.length > 1) {
delete words[0];
chan.send(owohelp(words.join(" ")) + " >.<");
}
else chan.send("You need to put something after the command, silly!");
}
function owohelp(nowo) {
if(nowo.length > 0) return owochar(nowo.charAt(0)) + owohelp(nowo.substr(1));
else return "";
// *notices recursion* senpai what's this? uwu
}
function owochar(c) {
if(c === 'r') return 'w';
if(c === 'o') return 'owo';
if(c === 'u') return 'uwu';
else return c;
}
function git(chan) {
chan.send('This project is open source, licensed under the GPL! You can find the repo here: https://github.com/Gigabitten/froggo');
}
function ping(user, chan) {
chan.send(`${author.username} is the big gay.`);
}
function help(chan) {
chan.send(descriptions.join("\n"));
}
function parse(trigger) {
trigger = trigger.toLowerCase();
return trigger;
}
function syncRead(file) {
return fs.readFileSync(file, 'utf8');
}
function syncWrite(file, data) {
fs.writeFileSync(file, data);
}
client.login('YOUR_TOKEN_GOES_HERE')