This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheggsi.js
148 lines (136 loc) · 6.1 KB
/
eggsi.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
const Eris = require("eris");
const hypixel = require("./api");
const EmbedBuilder = require('eris-embed-builder');
const vals = require("./config.json");
const {
JsonDB
} = require('node-json-db');
const {
Config
} = require('node-json-db/dist/lib/JsonDBConfig');
require('dotenv').config()
roles = {
"746716479021514754":"746715456747864066"
}
scammerroles = {
"746716479021514754":"749000601265766421"
}
class EggSi extends Eris.CommandClient{
constructor(db = new JsonDB(new Config("eggsiDatabase", true, true, '/')),
api = new hypixel.Client(process.env.hypixelToken),
scammerlist,
...args){
super(...args);
this.db = db;
this.api = api;
this.scammerlist = scammerlist;
this.registerCommand("ping", "pong!", {
description: "PONG!",
});
// this.registerCommand("splash", this.splash.bind(this), {
// description: "Trigger a Splash!",
// argsRequired: true,
// usage: "<hub|dungeon|party> <HubNum|party name> <location> <description>",
// cooldown: 1000,
// cooldownMessage: "How many splashes do you plan to do man."
// });
this.on("messageCreate",function (msg){
if(Object.keys(roles).includes(msg.channel.id)){
this.deleteMessage(msg.channel.id, msg.id);
}
if(msg.cleanContent.startsWith("-verify") || msg.cleanContent.startsWith("~verify")){
if(!Object.keys(roles).includes(msg.channel.id)) return;
this.verify(msg,msg.cleanContent.split(" ").slice(1));
return;
}
}.bind(this))
}
async splash(msg = new Eris.Message(),args){
if(!(await this.getRESTGuildMember("746130867847692479", msg.author.id)).roles.includes("746882739633913867"))
return("You are not allowed to use that command");
if(args.length < 3) return("Invalid Usage")
let embed = this.createEmbed();
// let embed = ;
switch (args[0].toLowerCase()){
case 'hub':
embed.field("Hub",args[1],true)
break;
case 'party':
embed.field("Party",`/p join ${args[1]}`,true)
break;
case 'dungeon':
embed.field("Dungeon Hub",args[1],true)
break;
default:
return("Invalid Usage")
}
embed.field("Place",args[2],true);
embed.field("Splasher",msg.author.mention,true);
// embed.title("SPLASH!");
if(args.slice(3).join(" ") !== "")
embed.field("Description",args.slice(3).join(" "));
embed.author(msg.author.username, `https://cdn.discordapp.com/avatars/${msg.author.id}/${msg.author.avatar}.png`);
embed.timestamp(new Date());
embed.color(0x00eeff);
// return({embed:embed.sendable});
// return("Splash Sequence Started");
this.createMessage(msg.channel.id,"Splash Sequence Started");
for(let channel of vals.splashChannelDono)
this.createMessage(channel.id,{content:channel.ping,embed:embed.sendable});
await new Promise(r => setTimeout(r, 90000));
embed.footer("<#720012518235570216> for Priority");
for(let channel of vals.splashChannelFree)
this.createMessage(channel.id,{content:channel.ping,embed:embed.sendable});
}
async verify(msg,args){
// this.sendChannelTyping(msg.channel.id);
let dm = this.getDMChannel(msg.author.id);
dm.then((dm) => dm.createMessage("Trying to Verify Your Discord"))
let player = null,
hyplayer = null
try {
player = await this.api.getPlayer(args[0]);
hyplayer = await this.api.gethypixelPlayer(player.id);
} catch (err) {
(await dm).createMessage(err)
return;
}
if(hyplayer.player.socialMedia == undefined || hyplayer.player.socialMedia.links == undefined || hyplayer.player.socialMedia.links.DISCORD.toLowerCase().replace(" ","_") !== `${msg.author.username.toLowerCase().replace(" ","_")}#${msg.author.discriminator}`){
dm = (await dm);
dm.createMessage("Please connect your Hypixel account to discord.")
dm.createMessage("https://gyazo.com/3a2358687dae9b4333fd2fef932e0a17");
try{
dm.createMessage(`Current username set to: \`${hyplayer.player.socialMedia.links.DISCORD.toLowerCase().replace(" ","_")}\``)
}catch(e){
dm.createMessage("You do not seem to have a Discord Username set")
}
return;
}
if(this.scammerlist[player.id]){
this.createMessage(vals.roleLogs,`A scammer (${player.name}) tried to Join, Not Banned (yet), Offence: ${this.scammerlist[player.id].reason}\nDiscordID: ${msg.author.id}`)
let dm = (await dm);
await dm.createMessage(`Sorry, You are banned from the guild for scamming (Reason: ${this.scammerlist[player.id].reason}), try contacting a admin if u think this is an error.`)
await this.addGuildMemberRole(msg.channel.guild.id, msg.author.id, scammerroles[msg.channel.id] , "SCAMMER!");
// this.banGuildMember(msg.guildID, msg.author.id, 0, "SCAMMER!")
}
this.db.push(`/ign/${msg.author.id}`, {discord:msg.author.username+"#"+msg.author.discriminator, uuid: player.id, username: player.name}); // TEST
await this.addGuildMemberRole(msg.channel.guild.id, msg.author.id, roles[msg.channel.id] , "Verified");
this.editGuildMember(msg.channel.guild.id, msg.author.id ,{nick:player.name}, "Changed nickname to IGN");
(await dm).createMessage("Successfully Verified");
}
}
if (module.parent) {
module.exports = EggSi;
}else{
// console.log(process.env.eggsiToken)
let bot = new EggSi(undefined,undefined,process.env.eggsiToken, {},{
description: "Totally not Upsi with a mask",
owner: "Anunay",
prefix: "-"
})
bot.connect().then(() => {
console.log("Logged in!");
}).catch(() => {
throw "Unable to connect";
});
}