im just that good
This commit is contained in:
parent
0d68c8c1e8
commit
07026c7bc4
1 changed files with 31 additions and 0 deletions
31
src/main.ts
31
src/main.ts
|
@ -83,6 +83,37 @@ client.on(Events.ClientReady, async () => {
|
||||||
client.on(Events.MessageCreate, async (message) => {
|
client.on(Events.MessageCreate, async (message) => {
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
if (!message.reference) return;
|
if (!message.reference) return;
|
||||||
|
if (message.content.startsWith("!strikecmd")){
|
||||||
|
const thing = message.content.split(" ")
|
||||||
|
if (thing.length == 1){
|
||||||
|
await message.reply('WHO ARE YOU STRIKING DUMBASS');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = (thing[1].match(/\d{9,10}/) || [])[0];
|
||||||
|
const memberId = await message.guild.members.fetch(id)
|
||||||
|
if (!id) {
|
||||||
|
await message.reply("invalid id")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let result: boolean | "duplicate";
|
||||||
|
try {
|
||||||
|
result = addOrUpdate(id, message.author.id)
|
||||||
|
} catch (e) {
|
||||||
|
message.reply('user SHOULD be already banned,,, idk lmao');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result === "duplicate") {
|
||||||
|
message.reply('you have already striked this person.');
|
||||||
|
}
|
||||||
|
if (result === true) {
|
||||||
|
await memberId.ban({reason: "ban by strike"});
|
||||||
|
await (await client.channels.fetch(config.publiclog) as DMChannel).send("user " + memberId.user.globalName + "was banned due to having 3 strikes. ");
|
||||||
|
}
|
||||||
|
if (result === false) {
|
||||||
|
await (await client.channels.fetch(config.publiclog) as DMChannel).send("user " + memberId.user.globalName + "got a new strike by " + message.author.globalName);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (message.content !== "!strike") return;
|
if (message.content !== "!strike") return;
|
||||||
await strike(message)
|
await strike(message)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue