-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnector.js
More file actions
105 lines (102 loc) · 2.81 KB
/
Copy pathconnector.js
File metadata and controls
105 lines (102 loc) · 2.81 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
const Discord = require('eris').Client;
const discord = new Discord();
discord.on('ready', () => {
// TODO: What do we need to do on connections?
});
discord.on('disconnect', () => {
// TODO: What do we need to do on disconnects?
// Pause the game? Allow it to run (and revalidate on ready)?
});
discord.on('guildCreate', (guild) => {
// TODO: joined a new server
// Initialize game!
// Add all members (except bots) to game
});
discord.on('guildDelete', (guild) => {
if (guild.unavailable) {
// Guild is unavailable for some reason
// TODO: What do we need to do in this case?
// Pause the game? Allow it to run anyway?
} else {
// Left the server
}
});
discord.on('guildMemberAdd', (guild, member) => {
// Ignore bots
if (member.bot) return;
// add them to the game
});
discord.on('guildMemberRemove', (guild, member) => {
// Ignore bots
if (member.bot) return;
// set offline
// penalize
// remove from memory
});
discord.on('guildMemberUpdate', (guild, member, old) => {
// TODO: Don't think we need this, it doesn't say *who* changed the nick
});
discord.on('messageReactionAdd', (message, emoji, userID) => {
// TODO: penalize for action
});
discord.on('messageReactionRemove', (message, emoji, userID) => {
// TODO: penalize for action
});
discord.on('presenceUpdate', (member, presence) => {
// Ignore bots
if (member.bot) return;
// TODO: Track offline status
// Don't penalize for status changes
});
discord.on('typingStart', (channel, user) => {
// Ignore bots
if (user.bot) return;
// TODO: A small penalty for being not idle? (maybe not)
});
discord.on('userUpdate', (user, oldUser) => {
// Ignore bots
if (user.bot) return;
// TODO: Is this needed?
});
discord.on('voiceChannelJoin', (member, channel) => {
// Ignore bots
if (member.bot) return;
// TODO: How dare you join voice
});
discord.on('voiceChannelLeave', (member, channel) => {
// Ignore bots
if (member.bot) return;
// TODO: How dare you leave!?
});
discord.on('voiceChannelSwitch', (member, oldChannel, newChannel) => {
// Ignore bots
if (member.bot) return;
// TODO: penalize? (admins can move you...)
});
discord.on('voiceStateUpdate', (member, oldState) => {
// Ignore bots
if (member.bot) return;
// TODO: penalize
});
discord.on('messageCreate', (message) => {
// Ignore bots
if (message.author.bot) return;
// If command... parse it
// TODO: Penalize for creation
});
discord.on('messageUpdate', (message, oldMessage) => {
// Ignore bots
if (message.author.bot) return;
// TODO: penalize for edit (less penalty than creation)
});
// "messageDelete" is a free action
module.exports = (token) => {
if (discord.ready) {
if (discord.token === token) {
return Promise.resolve();
}
discord.disconnect();
}
discord.token = token;
return discord.connect();
};