This repository has been archived by the owner on Jan 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
notes.txt
112 lines (85 loc) · 3.88 KB
/
notes.txt
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
client.setProvider(
sqlite.open({ filename: path.join(__dirname, 'database.db') }).then(db => new SQLiteProvider(db)),
).catch(console.error);
const db = new sqlite3.Database('./db/Prefix.db', sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, (err) => {
if (err) {
return console.error(err.message);
}
console.log('Connected to the Prefix SQlite database.');
});
client.setProvider(
new SQLiteProvider(db),
);
if (!message.member.voice.channel.join()) {
if (!message.author.voiceChannel) return client2.sendMessage(message, 'You need to be in a voice channel');
client2.joinVoiceChannel(message.author.voiceChannel);
}
const receivedEmbed = message.embeds[(findInMessage(message, caseid))];
message.channel.send('Case found.');
const schannel = await schanneldb.get(message.guild.id);
const sChannel = message.guild.channels.cache.find(c => c.name === schannel);
if (!sChannel) return;
message = await sChannel.fetch_message(caseid);
await sChannel.send(message.embeds[0].description);
}
if (!casenum[message.guild.id]) {
casenum[message.guild.id] = {
case: 0,
};
}
casenum[message.guild.id].case++;
fs.writeFile('./casenum.json', JSON.stringify(casenum), (err) => {
if (err) {
console.log(err);
}
});
const schannel = await schanneldb.get(message.guild.id);
const embed = new discord.MessageEmbed()
.setColor('#738ADB')
.setAuthor(message.author.tag, message.author.avatarURL())
.setTitle(`Suggestion #${casenum[message.guild.id].case}`)
.setDescription(suggest);
const sChannel = message.guild.channels.cache.find(c => c.name === schannel);
if (!sChannel) return;
message.reply(`Suggestion sent to ${sChannel}.`);
sChannel.send({ embed: embed }).then(embedMessage => {
console.log(message.id);
smID.set(message.guild.id, message.id);
embedMessage.react('⬆️'),
embedMessage.react('⬇️');
});
}
const receivedEmbed = message.embeds[(findInMessage(message, casenum))];
const embed = new discord.MessageEmbed()
.setColor('#71EEB8')
.setTitle(`Suggestion #${casenum} Approved`)
.addField(`Comment from ${message.author.tag}:`, comments);
const schannel = await schanneldb.get(message.guild.id);
const sChannel = message.guild.channels.cache.find(c => c.name === schannel);
if (!sChannel) return;
const EditEmbed = smID.get(casenum);
const EditEmbed2 = await sChannel.messages.fetch(EditEmbed);
await sChannel.messages.fetch(EditEmbed).then(
EditEmbed2.edit(embed));
if(!message.member.hasPermission("MANAGE_SERVER")) return message.channel.send('You can\'t use that');
const user = message.mentions.users.first() || message.guild.members.cache.get(args[0]);
if(!user) return message.channel.send('Please specify a user, via mention or ID');
if(user.bot) return message.channel.send('You can\'t warn bots');
if(message.author.id === user.id) return message.channel.send('You can\'t warn yourself nitwit');
if(message.guild.owner.id === user.id) return message.channel.send('You can\'t warn the server\'s owner');
let reason = args.slice(1).join(" ");
if(!reason) reason = 'Unspecified';
let warnings = db.get(`warnings_${message.guild.id}_${user.id}`);
if(warnings === 3) return message.channel.send(`${user} has already reached three warnings`);
if(warnings === null) {
db.set(`warnings_${message.guild.id}_${user.id}`, 1);
user.send(`You were warned in ${message.guild.name} for the follwoing reason: \`${reason}\``)
await message.channel.send(`**${user.username}** has been warned`)
}
if(warnings !== null){
db.add(`warnings_${message.guild.id}_${user.id}`, 1)
user.send(`You were warned in ${message.guild.name} for the follwoing reason: \`${reason}\``)
await message.channel.send(`**${user.username}** has been warned`)
}
}
}