diff --git a/src/main.ts b/src/main.ts index b02102c..c4c74c2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -83,6 +83,37 @@ client.on(Events.ClientReady, async () => { client.on(Events.MessageCreate, async (message) => { if (message.author.bot) 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; await strike(message) })