import { token } from "./config.json"; import { Interaction } from "discord.js"; import { Client, Events, GatewayIntentBits, MessageFlags } from "discord.js"; import type { SlashCommandBuilder } from "discord.js"; import * as _pingCommand from "./commands/calendar/ping.ts"; import RemindCommand from "./commands/calendar/remind.ts"; interface Command { data: SlashCommandBuilder; execute: (i: Interaction) => void; } const pingCommand = _pingCommand as Command; const BLITZCRANK_BANNER = ` ****++++++++++*+++ **+*+******+********+******+*++* **** *+*+**+*+*+*++++++++++++++*+++++*++++*** *=....... + **+*+*+++++++++++++++++++++++++++*++++++++++** ............= +****+*+*+++++++++#%%#######%*++++++++++++++**+**+** *.....=@@@@+......+*+++++++++++##*#*++++++++++***%*+++++****++++++*+*++ .... @@. ..@% .. ..*++++++++%***++=%=+=======+++++**@+++++++++*++++*++**+ .....=@-...:@#.....+*+++++%***++====+====--==-====++**#+++++++++**+++**+*+* .........@@@@-....-*++++#****++==---%:::::-------===+**#++++*++++++++++++***+ +.... +@. .........+++%***+++==--::==.::::::+##*-===+**%++++++++++++++++++*+++ *.......: .......--:.=@***++++=-::::.*....:=+:...-*-==+***+++++++++**+++++****+* *.......=%:......*+++****+%==-=*+::..--....*-.....=+==++*#++++++++++++++**++++*+** *+ ......+++++++++#+++*-::::::*....#....*+....:+:==++**%++++++++++++++*++++++++* *+++++*+*++++*++++#++#-:.......+...-+...:.#**#=-===+++*#+++++++*++++*++++**+++*+* *++*+++*+*+++++++++#*=#::.......+.::.#::::-=========+++**+++++++++++++++++++*+++*++ *+**+++++++++++++++*%*+=-........+-:::-#::---========+++#@=+++++++++++++++++++++++*+* ****+++*+**+*+++++++*%**+++:....+#=-----%-----========++@+===+++++++++++++++*+*+*++*** ***+++++++++++++*++++@****-+#%%*:===----=*-===========%#*@%%%%%%%%%%#*+++++++++++++++** **+*++*++++++++++*++++%#***++++++=========%======#%*==#***%###*******#%%%%@*++++++++++*+* **+*+++++++*+++++*++++*@*****++++++========#==#+===----=+#%#****++++*****@####++++++*+*+* +***++++*++++++++++++++@@#****++++++=======##===---------.%#*@%*+++++++**%#+**#++++*++*** *+*+*++++++++++++++++++==%@@#%@@+++++========%##:-----::%*##=#-::#*++++++*@=++#*#+++++++*++ *+*+*++++++*++++++++++=%%%@%@#####+++=======-%####+:=**#**--::--=##++++++==++####%+++++++** ***++++++++*+++++++++%%%@###%@#*#*%++=========@*#*##%#=-::--=++%+-#=+======+####**%++++*+*+ *+*+++++++++++++++++%%%#########%@%%*++======+%@%*##+*-*===#+-=====%=@#===#######**%+++++*+ *+*++++++++++++++++%%%####**********#%%%%%%#*+++*#%*#*+#*-:=========%::-*########*#++++++*+ *+*++++*++++++++++*##%##*****************+++++++++*#*##@*-===========%*##########*#++++*+*+ ***+*++*+++*++++++%###*%*****++++++++++++++***####%*#*@*##:===========%###########+++++*+*+ ++***++++*++++++++%#%*****##*+++++++++++**###%%+=====:@*##%-=========+#%########*++++*+++++ *+***++*+*+*++++++%#%%%#++**+++##+++++*####@===========:@###-======%%#%%######%++++++++**** ***+++*++++++++++##%%####%#*==+=++*####@==+#========----:@#%-=#%%##%*=%*#####+++++++*+*+* +***++*++++++++++##%%%########%%%%%%%*=====-%+-====----::-#%%%##%+-*+##+*#@++++++++++**+* *+*++++++*++++++#%%%%%#######%%@@@==========:*:---:::::#*%%%#+-#*##%%+:#++++++*++++*+*+* *++*+++*++++++++++%%%%######%%@@%@*=======---.*+::.-+*###*+**###%%+:=#*#++++*++++++***+ +*++*+**++*++++++++%%%####%@@@@@@%%=====---::.+++**##+++=*%%%%*:-*****#%#*%#*++*++*+* ++*+++++++*++++++++++@%%%@@@@@@@@%%-==--::.:#*%##+-++###%#*::#***#**%=:-#**%++++*+++ **+++*+++++++++++++++++++%@@@@@@@@%%:-:.=**#%#%*+*###%#=::+*####*%#*=:#***#*+++**+ *++***++*+++++++++++++++++++++*#%@%@-#*#%*+*=*%%#%#+::+*#######*%#**##***%+++*+** *++**+++*++++++++++++++++++++++%#%#%%**-+####%#=::+*####%#####*%*####**%+++++++ +*+*+*+**+++*++*+++++++++++++*%#%#%*#%*%%#=:+*#####%***##**%#*@###*%*++++** ***+*++++++*++++++++*+++++++++%#%#%%%#=-+###########*-::-+##%#%%%%+****++ *+++++++++++++++++++++++++++++%%%%++############*%*=-#*###*@#%%%+**+*+ *+++*+*+*++++++++++++++++++++#%#####%##################*%#*#%***+++ ++*+*+**+*+***++++*++++***++*%###%#*%%###%*##%%#####@%%%%***+** *+*++++*+++++++++++++++++++*%#%%+=:..:=+=%#%%%%%%%%%%*+*+*+ +*++***++++++++++++++++++++%%#*#*#######%#%%%%%%#+**+* **+*******+++**++**++*++#%%#########%%#%%%**++*+ ++**+*++++*+*+++++++++@#######%%%#*++***** **+*+*****++********##**+*++*+**+ +******************+ "FIRED UP AND READY TO SERVE!" `; const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, ], }); const remindCommand = RemindCommand({ client: client, }); client.on(Events.InteractionCreate, async (interaction: Interaction) => { if (!interaction.isChatInputCommand()) { return; } try { switch (interaction.commandName) { case "ping": return pingCommand.execute(interaction); case "remind": return remindCommand.execute(interaction); default: return console.error(`No matching command ${interaction.commandName}`); } } catch (error) { console.error(error); if (interaction.replied || interaction.deferred) { await interaction.followUp({ content: "There was an error while executing this command", flags: MessageFlags.Ephemeral, }); } } // TODO }); client.once(Events.ClientReady, async (readyClient) => { await remindCommand.initialize(); // Print banner for (const ln of BLITZCRANK_BANNER.split("\n")) { console.log(ln); } console.log(`Logged in as ${readyClient.user.tag}`); }); client.login(token);