WIP: Format code with Google Typescript formatting guidelines

This commit is contained in:
2025-07-04 10:39:32 -04:00
parent e53d38e0ad
commit c834acdfec
12 changed files with 596 additions and 235 deletions

6
Justfile Normal file
View File

@@ -0,0 +1,6 @@
fmt:
just format
format:
bunx --bun @biomejs/biome format --write *.ts commands/

12
biome.jsonc Normal file
View File

@@ -0,0 +1,12 @@
{
"javascript": {
// This is taken from the Google TS style guide:
// https://github.com/google/gts/blob/main/.prettierrc.json
"formatter": {
"bracketSpacing": false,
"quoteStyle": "single",
"trailingCommas": "all",
"arrowParentheses": "asNeeded"
}
}
}

View File

@@ -1,23 +1,21 @@
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js"; import {ChatInputCommandInteraction, SlashCommandBuilder} from 'discord.js';
import { Settings } from "./common"; import {Settings} from './common';
import { Nag, CheckIn } from './common'; import {Nag, CheckIn} from './common';
const data = new SlashCommandBuilder() const data = new SlashCommandBuilder()
.setName("checkin") .setName('checkin')
.setDescription("Check-in for your daily nag") .setDescription('Check-in for your daily nag')
.addStringOption((option) => .addStringOption(option =>
option option
.setName("text") .setName('text')
.setDescription("Optional description of what you have achieved"), .setDescription('Optional description of what you have achieved'),
); );
async function initialize(settings: Settings) {} async function initialize(settings: Settings) {}
function execute(interaction: ChatInputCommandInteraction) { function execute(interaction: ChatInputCommandInteraction) {}
}
export default function () { export default function () {
return { return {

View File

@@ -3,7 +3,7 @@ import {
Client, Client,
SlashCommandBuilder, SlashCommandBuilder,
TextChannel, TextChannel,
} from "discord.js"; } from 'discord.js';
import { import {
Sequelize, Sequelize,
Model, Model,
@@ -12,7 +12,7 @@ import {
BOOLEAN, BOOLEAN,
DATE, DATE,
literal, literal,
} from "sequelize"; } from 'sequelize';
export interface Settings { export interface Settings {
client: Client; // Main Discord client object client: Client; // Main Discord client object
@@ -63,7 +63,7 @@ export async function initAndSyncTables(sequelize: Sequelize) {
type: BOOLEAN, type: BOOLEAN,
}, },
}, },
{ sequelize }, {sequelize},
); );
CheckIn.init( CheckIn.init(
{ {
@@ -76,14 +76,14 @@ export async function initAndSyncTables(sequelize: Sequelize) {
allowNull: false, allowNull: false,
}, },
}, },
{ sequelize }, {sequelize},
); );
Nag.hasOne(CheckIn, { foreignKey: "nagId" }); Nag.hasOne(CheckIn, {foreignKey: 'nagId'});
await Nag.sync(); await Nag.sync();
await CheckIn.sync(); await CheckIn.sync();
} }
import { Guild, Channel } from "discord.js"; import {Guild, Channel} from 'discord.js';
export class Plugin { export class Plugin {
settings: Settings; settings: Settings;
@@ -106,7 +106,7 @@ export class Plugin {
async triggerNag(nag: Nag) { async triggerNag(nag: Nag) {
const client = this.settings.client; const client = this.settings.client;
const chan = client.channels.cache.get("1234"); // TODO const chan = client.channels.cache.get('1234'); // TODO
if (!(chan instanceof TextChannel)) { if (!(chan instanceof TextChannel)) {
return; // TODO return; // TODO
} }
@@ -114,16 +114,16 @@ export class Plugin {
const failText = const failText =
nag.failText ?? nag.failText ??
`<@${nag.userId}> didn't complete "${nag.text}". Shame shame!`; `<@${nag.userId}> didn't complete "${nag.text}". Shame shame!`;
const mentionHere = nag.mentionHere ? "<@here> " : ""; const mentionHere = nag.mentionHere ? '<@here> ' : '';
const msg = `${mentionHere}${failText}`; const msg = `${mentionHere}${failText}`;
await chan.send(msg); await chan.send(msg);
} catch (error) { } catch (error) {
console.log("Error while creating Nag:", error); // TODO console.log('Error while creating Nag:', error); // TODO
} }
} }
async loop() { async loop() {
console.debug("nag.js main loop"); console.debug('nag.js main loop');
// Find all nags where the last check-in was before (next check in) - (24 hours) // Find all nags where the last check-in was before (next check in) - (24 hours)
} }

View File

@@ -2,30 +2,30 @@ import {
ChatInputCommandInteraction, ChatInputCommandInteraction,
Client, Client,
SlashCommandBuilder, SlashCommandBuilder,
} from "discord.js"; } from 'discord.js';
import { Sequelize, literal } from "sequelize"; import {Sequelize, literal} from 'sequelize';
import { Nag, CheckIn, Settings } from "./common"; import {Nag, CheckIn, Settings} from './common';
import { Chrono } from "chrono-node"; import {Chrono} from 'chrono-node';
const data = new SlashCommandBuilder() const data = new SlashCommandBuilder()
.setName("nag") .setName('nag')
.setDescription("Let Blitzcrank nag you every day about something") .setDescription('Let Blitzcrank nag you every day about something')
.addStringOption((option) => .addStringOption(option =>
option option
.setRequired(true) .setRequired(true)
.setName("text") .setName('text')
.setDescription("What you have to do every day"), .setDescription('What you have to do every day'),
) )
.addStringOption((option) => .addStringOption(option =>
option option
.setName("failText") .setName('failText')
.setDescription("Custom message to be broadcast on failure"), .setDescription('Custom message to be broadcast on failure'),
) )
.addBooleanOption((option) => .addBooleanOption(option =>
option option
.setName("mentionHere") .setName('mentionHere')
.setDescription("Whether to DM you or @ a channel") .setDescription('Whether to DM you or @ a channel')
.setRequired(false), .setRequired(false),
); );
@@ -41,7 +41,7 @@ function lateCheckedInUsers() {
async function initialize(settings: Settings) {} async function initialize(settings: Settings) {}
async function execute(interaction: ChatInputCommandInteraction) { async function execute(interaction: ChatInputCommandInteraction) {
const text = interaction.options.getString("text"); const text = interaction.options.getString('text');
if (text === null || text === undefined) { if (text === null || text === undefined) {
await interaction.reply("Nag can't have a blank `text`, try again."); await interaction.reply("Nag can't have a blank `text`, try again.");
return; return;
@@ -49,15 +49,15 @@ async function execute(interaction: ChatInputCommandInteraction) {
const nag = await Nag.create({ const nag = await Nag.create({
userId: interaction.user.id, userId: interaction.user.id,
text: text, text: text,
failText: interaction.options.getString("failText"), failText: interaction.options.getString('failText'),
mentionHere: interaction.options.getBoolean("mentionHere") ?? false, mentionHere: interaction.options.getBoolean('mentionHere') ?? false,
}); });
await nag.save(); await nag.save();
const chrono = new Chrono(); const chrono = new Chrono();
const checkIn = chrono.parseDate("today at 9AM"); const checkIn = chrono.parseDate('today at 9AM');
if (!checkIn) { if (!checkIn) {
await interaction.reply( await interaction.reply(
"Internal error while saving your nag. Tell Drew the bot is broken!!!", 'Internal error while saving your nag. Tell Drew the bot is broken!!!',
); );
return; return;
} }

View File

@@ -2,19 +2,16 @@ import {
ChatInputCommandInteraction, ChatInputCommandInteraction,
Client, Client,
SlashCommandBuilder, SlashCommandBuilder,
} from "discord.js"; } from 'discord.js';
import { Sequelize } from "sequelize"; import {Sequelize} from 'sequelize';
import { Settings } from './common'
import {Settings} from './common';
const data = new SlashCommandBuilder() const data = new SlashCommandBuilder()
.setName("unnag") .setName('unnag')
.setDescription("Remove a nag"); .setDescription('Remove a nag');
async function initialize(settings: Settings) {}
async function initialize(settings: Settings) {
}
async function execute(interaction: ChatInputCommandInteraction) { async function execute(interaction: ChatInputCommandInteraction) {
return; return;
@@ -24,6 +21,6 @@ export default function (settings: Settings) {
return { return {
data, data,
execute, execute,
initialize: async() => await initialize(settings), initialize: async () => await initialize(settings),
}; };
} }

View File

@@ -1,15 +1,15 @@
import { type Client, SlashCommandBuilder } from "discord.js"; import {type Client, SlashCommandBuilder} from 'discord.js';
import type { Sequelize } from "sequelize"; import type {Sequelize} from 'sequelize';
export default function (settings: { client: Client; db: Sequelize }) { export default function (settings: {client: Client; db: Sequelize}) {
return { return {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("ping") .setName('ping')
.setDescription("Send a ping to the bot"), .setDescription('Send a ping to the bot'),
initialize: async () => {}, initialize: async () => {},
execute: async (interaction) => { execute: async interaction => {
await interaction.reply( await interaction.reply(
`Pong! This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`, `Pong! This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`,
); );

View File

@@ -5,10 +5,10 @@ import {
TextChannel, TextChannel,
type ChatInputCommandInteraction, type ChatInputCommandInteraction,
type Client, type Client,
} from "discord.js"; } from 'discord.js';
import { type Sequelize, Model, INTEGER, TEXT, DATE, BOOLEAN } from "sequelize"; import {type Sequelize, Model, INTEGER, TEXT, DATE, BOOLEAN} from 'sequelize';
import * as sequelize from "sequelize"; import * as sequelize from 'sequelize';
import * as chrono from "chrono-node"; import * as chrono from 'chrono-node';
// const REMINDERS_CHANNEL = "1062196593379520593"; // #bot-test-channel // const REMINDERS_CHANNEL = "1062196593379520593"; // #bot-test-channel
// const REMINDERS_CHANNEL = ""; // #general // const REMINDERS_CHANNEL = ""; // #general
@@ -22,18 +22,18 @@ interface Settings {
} }
const data = new SlashCommandBuilder() const data = new SlashCommandBuilder()
.setName("remind") .setName('remind')
.setDescription("Remind me to do something") .setDescription('Remind me to do something')
.addStringOption((option) => .addStringOption(option =>
option option
.setName("when") .setName('when')
.setDescription("Short description of when you want the reminder") .setDescription('Short description of when you want the reminder')
.setRequired(true), .setRequired(true),
) )
.addStringOption((option) => .addStringOption(option =>
option option
.setName("what") .setName('what')
.setDescription("Short description of what you want to be reminded of") .setDescription('Short description of what you want to be reminded of')
.setRequired(true), .setRequired(true),
); );
@@ -62,17 +62,17 @@ class Plugin {
// if (this.settings.responseMode === "private") { // if (this.settings.responseMode === "private") {
// channel = getSendableTextChannel(client, reminder.requestChannel); // channel = getSendableTextChannel(client, reminder.requestChannel);
// } // }
if (this.settings.responseMode === "public" || !channel) { if (this.settings.responseMode === 'public' || !channel) {
channel = getSendableTextChannel(client, publicChannel); channel = getSendableTextChannel(client, publicChannel);
} }
if (!channel) { if (!channel) {
throw Error("Cannot find valid channel to send reminder on"); throw Error('Cannot find valid channel to send reminder on');
} }
return channel; return channel;
} }
async loop() { async loop() {
console.debug("remind.js main loop"); console.debug('remind.js main loop');
const results = await Reminder.findAll({ const results = await Reminder.findAll({
// NOTE: 'trigger' is the time when the reminder should go off. If trigger - // NOTE: 'trigger' is the time when the reminder should go off. If trigger -
// now is positive, trigger is in the future. If trigger - now <= // now is positive, trigger is in the future. If trigger - now <=
@@ -87,7 +87,7 @@ class Plugin {
const now = new Date(Date.now()); const now = new Date(Date.now());
const delay = reminder.trigger.getTime() - now.getTime(); const delay = reminder.trigger.getTime() - now.getTime();
console.log( console.log(
`Callback for Reminder ${reminder.get("id")} triggering in ${delay}ms`, `Callback for Reminder ${reminder.get('id')} triggering in ${delay}ms`,
); );
const channel = this.getChannel(reminder); const channel = this.getChannel(reminder);
setTimeout(async () => await triggerReminder(channel, reminder), delay); setTimeout(async () => await triggerReminder(channel, reminder), delay);
@@ -113,7 +113,7 @@ class Plugin {
} }
async function initialize(settings: Settings) { async function initialize(settings: Settings) {
console.log("Initializing remind.js"); console.log('Initializing remind.js');
// Populate Reminder table inside SQLite DB // Populate Reminder table inside SQLite DB
Reminder.init( Reminder.init(
@@ -136,7 +136,7 @@ async function initialize(settings: Settings) {
requestChannel: TEXT, requestChannel: TEXT,
requestMessage: TEXT, requestMessage: TEXT,
}, },
{ sequelize: settings.db }, {sequelize: settings.db},
); );
await Reminder.sync(); await Reminder.sync();
@@ -144,13 +144,13 @@ async function initialize(settings: Settings) {
console.debug(`Accessing channel ${settings.publicChannel}`); console.debug(`Accessing channel ${settings.publicChannel}`);
if (!getSendableTextChannel(settings.client, settings.publicChannel)) { if (!getSendableTextChannel(settings.client, settings.publicChannel)) {
throw Error( throw Error(
"Invalid value for publicChannel; specify a channel the bot can access.", 'Invalid value for publicChannel; specify a channel the bot can access.',
); );
} }
// Initialize the 'plugin' object which will store all state required to control the mainloop. // Initialize the 'plugin' object which will store all state required to control the mainloop.
if (settings.loopIntervalSec == null || settings.loopIntervalSec <= 0) { if (settings.loopIntervalSec == null || settings.loopIntervalSec <= 0) {
console.log("Setting plugin loop interval to default of 60 seconds"); console.log('Setting plugin loop interval to default of 60 seconds');
settings.loopIntervalSec = 60; settings.loopIntervalSec = 60;
} }
const plugin = new Plugin(settings); const plugin = new Plugin(settings);
@@ -164,13 +164,13 @@ function getSendableTextChannel(client: Client, chanId: string) {
throw Error("Can't check non-existent client"); throw Error("Can't check non-existent client");
} }
if (!channel) { if (!channel) {
throw Error("No such channel is visible to Blitz"); throw Error('No such channel is visible to Blitz');
} }
if (!channel?.isSendable()) { if (!channel?.isSendable()) {
throw Error("Channel is not a text channel, or otherwise not Sendable"); throw Error('Channel is not a text channel, or otherwise not Sendable');
} }
if (!(channel instanceof TextChannel)) { if (!(channel instanceof TextChannel)) {
throw Error("Channel is not a guild channel"); throw Error('Channel is not a guild channel');
} }
const permissions = channel?.permissionsFor(client.user); const permissions = channel?.permissionsFor(client.user);
const requiredPerms = new PermissionsBitField([ const requiredPerms = new PermissionsBitField([
@@ -178,7 +178,7 @@ function getSendableTextChannel(client: Client, chanId: string) {
PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.ViewChannel,
]); ]);
if (!permissions?.has(requiredPerms)) { if (!permissions?.has(requiredPerms)) {
throw Error("Missing required permissions: SendMessages, ViewChannel"); throw Error('Missing required permissions: SendMessages, ViewChannel');
} }
return channel; return channel;
} }
@@ -197,7 +197,7 @@ async function triggerReminder(channel: TextChannel, reminder: Reminder) {
} }
async function execute(interaction: ChatInputCommandInteraction) { async function execute(interaction: ChatInputCommandInteraction) {
const whenString = interaction.options.getString("when") ?? "now"; const whenString = interaction.options.getString('when') ?? 'now';
const when = chrono.parseDate(whenString); const when = chrono.parseDate(whenString);
if (!when) { if (!when) {
await interaction.reply(`Sorry, I don't understand '${when}' as a date`); await interaction.reply(`Sorry, I don't understand '${when}' as a date`);
@@ -205,7 +205,7 @@ async function execute(interaction: ChatInputCommandInteraction) {
} }
const reminder = await Reminder.create({ const reminder = await Reminder.create({
userId: interaction.user.id, userId: interaction.user.id,
text: interaction.options.getString("what"), text: interaction.options.getString('what'),
trigger: when, // TODO trigger: when, // TODO
requestMessage: interaction.id, requestMessage: interaction.id,
requestChannel: interaction.channelId, requestChannel: interaction.channelId,

View File

@@ -4,10 +4,10 @@ import {
type ChatInputCommandInteraction, type ChatInputCommandInteraction,
type Client, type Client,
type InviteStageInstance, type InviteStageInstance,
} from "discord.js"; } from 'discord.js';
import type { Sequelize } from "sequelize"; import type {Sequelize} from 'sequelize';
import { quotes } from "./quotes.json"; import {quotes} from './quotes.json';
async function execute(interaction: ChatInputCommandInteraction) { async function execute(interaction: ChatInputCommandInteraction) {
try { try {
@@ -26,8 +26,8 @@ async function initialize() {}
export default function (settings: {}) { export default function (settings: {}) {
return { return {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("quote") .setName('quote')
.setDescription("Print a quote from League of Legends."), .setDescription('Print a quote from League of Legends.'),
initialize: initialize, initialize: initialize,
execute: execute, execute: execute,
}; };

View File

@@ -3,169 +3,517 @@
{ "author": "Blitzcrank", "quote": "A rolling golem gathers no rust." }, { "author": "Blitzcrank", "quote": "A rolling golem gathers no rust." },
{ "author": "Blitzcrank", "quote": "Fired up and ready to serve." }, { "author": "Blitzcrank", "quote": "Fired up and ready to serve." },
{ "author": "Blitzcrank", "quote": "Metal is harder than flesh." }, { "author": "Blitzcrank", "quote": "Metal is harder than flesh." },
{ "author": "Camille", "quote": "[Speaking to Warwick] We are all monsters. Now, you are just one on the outside." }, {
"author": "Camille",
"quote": "[Speaking to Warwick] We are all monsters. Now, you are just one on the outside."
},
{ "author": "Camille", "quote": "Efficiency is paramount to success." }, { "author": "Camille", "quote": "Efficiency is paramount to success." },
{ "author": "Camille", "quote": "Elegance never goes out of fashion." }, { "author": "Camille", "quote": "Elegance never goes out of fashion." },
{ "author": "Camille", "quote": "Extremes are easy, it's the balance that is difficult." }, {
{ "author": "Camille", "quote": "I don't play the game, I make the rules." }, "author": "Camille",
{ "author": "Camille", "quote": "I'm what you would call a 'deniable asset'." }, "quote": "Extremes are easy, it's the balance that is difficult."
{ "author": "Camille", "quote": "It is not the weapon that defines you, but how you wield it." }, },
{ "author": "Camille", "quote": "It's not lies that cut, but the sharpness of the truth." }, {
"author": "Camille",
"quote": "I don't play the game, I make the rules."
},
{
"author": "Camille",
"quote": "I'm what you would call a 'deniable asset'."
},
{
"author": "Camille",
"quote": "It is not the weapon that defines you, but how you wield it."
},
{
"author": "Camille",
"quote": "It's not lies that cut, but the sharpness of the truth."
},
{ "author": "Camille", "quote": "Mediocrity is the root of all evil." }, { "author": "Camille", "quote": "Mediocrity is the root of all evil." },
{ "author": "Camille", "quote": "Morality is a beautiful servant and a dangerous master." }, {
{ "author": "Camille", "quote": "Precision is the difference between a butcher and a surgeon." }, "author": "Camille",
{ "author": "Camille", "quote": "Privilege must be preserved at all costs." }, "quote": "Morality is a beautiful servant and a dangerous master."
},
{
"author": "Camille",
"quote": "Precision is the difference between a butcher and a surgeon."
},
{
"author": "Camille",
"quote": "Privilege must be preserved at all costs."
},
{ "author": "Camille", "quote": "Progress is honed on necessary death." }, { "author": "Camille", "quote": "Progress is honed on necessary death." },
{ "author": "Camille", "quote": "Progress is served by technology, not controlled by it." }, {
{ "author": "Camille", "quote": "Regret is what tempers the steel of our soul." }, "author": "Camille",
"quote": "Progress is served by technology, not controlled by it."
},
{
"author": "Camille",
"quote": "Regret is what tempers the steel of our soul."
},
{ "author": "Camille", "quote": "Results are all that matters." }, { "author": "Camille", "quote": "Results are all that matters." },
{ "author": "Camille", "quote": "Self-made women need to be more prevalent." }, {
{ "author": "Camille", "quote": "Sometimes scars are the most refined attire one can wear." }, "author": "Camille",
{ "author": "Camille", "quote": "The right word cuts more deeply than a knife." }, "quote": "Self-made women need to be more prevalent."
{ "author": "Camille", "quote": "The task at hand is the only one that matters." }, },
{ "author": "Camille", "quote": "The world is not black or white, but a delicious shade of grey." }, {
"author": "Camille",
"quote": "Sometimes scars are the most refined attire one can wear."
},
{
"author": "Camille",
"quote": "The right word cuts more deeply than a knife."
},
{
"author": "Camille",
"quote": "The task at hand is the only one that matters."
},
{
"author": "Camille",
"quote": "The world is not black or white, but a delicious shade of grey."
},
{ "author": "Camille", "quote": "Violence is a means to an end." }, { "author": "Camille", "quote": "Violence is a means to an end." },
{ "author": "Ekko", "quote": "A second chance? I thought I was on my fifth!" }, {
"author": "Ekko",
"quote": "A second chance? I thought I was on my fifth!"
},
{ "author": "Ekko", "quote": "Good a time as any to act reckless." }, { "author": "Ekko", "quote": "Good a time as any to act reckless." },
{ "author": "Ekko", "quote": "It's not how much time you have, it's how you use it." }, {
"author": "Ekko",
"quote": "It's not how much time you have, it's how you use it."
},
{ "author": "Ekko", "quote": "Never had luck. Never needed it." }, { "author": "Ekko", "quote": "Never had luck. Never needed it." },
{ "author": "Ekko", "quote": "Time doesn't heal all wounds." }, { "author": "Ekko", "quote": "Time doesn't heal all wounds." },
{ "author": "Heimerdinger", "quote": "42... there's just something about that number." }, {
{ "author": "Heimerdinger", "quote": "I prefer a battle of wits, but you're unarmed!" }, "author": "Heimerdinger",
{ "author": "Heimerdinger", "quote": "Why do chemists call helium, curium, and barium 'the medical elements'? Because, if you can't 'helium' or 'curium', you 'barium'! Hm hm!" }, "quote": "42... there's just something about that number."
},
{
"author": "Heimerdinger",
"quote": "I prefer a battle of wits, but you're unarmed!"
},
{
"author": "Heimerdinger",
"quote": "Why do chemists call helium, curium, and barium 'the medical elements'? Because, if you can't 'helium' or 'curium', you 'barium'! Hm hm!"
},
{ "author": "Heimerdinger", "quote": "ヽ༼ຈل͜ຈ༽ノ raise your dongers" }, { "author": "Heimerdinger", "quote": "ヽ༼ຈل͜ຈ༽ノ raise your dongers" },
{ "author": "Jhin", "quote": "Art must exist beyond reason." }, { "author": "Jhin", "quote": "Art must exist beyond reason." },
{ "author": "Jhin", "quote": "Four!" }, { "author": "Jhin", "quote": "Four!" },
{ "author": "Jhin", "quote": "I cannot be good. I must be perfection." }, { "author": "Jhin", "quote": "I cannot be good. I must be perfection." },
{ "author": "Jhin", "quote": "I swear each performance is the last, but I lie every time." }, {
{ "author": "Jhin", "quote": "In carnage, I bloom, like a flower in the dawn." }, "author": "Jhin",
{ "author": "Jhin", "quote": "It is by my will alone I set my mind in motion." }, "quote": "I swear each performance is the last, but I lie every time."
{ "author": "Jhin", "quote": "It's fun to kill a man, to take all that he had, and could ever have." }, },
{
"author": "Jhin",
"quote": "In carnage, I bloom, like a flower in the dawn."
},
{
"author": "Jhin",
"quote": "It is by my will alone I set my mind in motion."
},
{
"author": "Jhin",
"quote": "It's fun to kill a man, to take all that he had, and could ever have."
},
{ "author": "Jhin", "quote": "You will learn what beauty truly is." }, { "author": "Jhin", "quote": "You will learn what beauty truly is." },
{ "author": "Jinx", "quote": "Fishbones, you know what we oughta do? 'Do the laundry, wash dishes and pay some bills.' Stupid dumb rocket launcher..." }, {
"author": "Jinx",
"quote": "Fishbones, you know what we oughta do? 'Do the laundry, wash dishes and pay some bills.' Stupid dumb rocket launcher..."
},
{ "author": "Jinx", "quote": "I'm crazy! Got a doctor's note." }, { "author": "Jinx", "quote": "I'm crazy! Got a doctor's note." },
{ "author": "Jinx", "quote": "I'm trying to care! But I just... can't!" }, { "author": "Jinx", "quote": "I'm trying to care! But I just... can't!" },
{ "author": "Jinx", "quote": "Rules are made to be broken... like buildings! Or people!" }, {
{ "author": "Joseph Miklos", "quote": "'It's only a short way'? Is that a short joke?!" }, "author": "Jinx",
"quote": "Rules are made to be broken... like buildings! Or people!"
},
{
"author": "Joseph Miklos",
"quote": "'It's only a short way'? Is that a short joke?!"
},
{ "author": "Joseph Miklos", "quote": "I am evil! Stop laughing!" }, { "author": "Joseph Miklos", "quote": "I am evil! Stop laughing!" },
{ "author": "Joseph Miklos", "quote": "Know that if the tables were turned, I would show you no mercy!" }, {
"author": "Joseph Miklos",
"quote": "Know that if the tables were turned, I would show you no mercy!"
},
{ "author": "Joseph Miklos", "quote": "You will die by my hand!" }, { "author": "Joseph Miklos", "quote": "You will die by my hand!" },
{ "author": "Mordekaiser", "quote": "Ah, life is a bitter shame." }, { "author": "Mordekaiser", "quote": "Ah, life is a bitter shame." },
{ "author": "Mordekaiser", "quote": "All mortals reek with the stench of decaying flesh." }, {
{ "author": "Mordekaiser", "quote": "Fools fear death, the strong wield it." }, "author": "Mordekaiser",
{ "author": "Mordekaiser", "quote": "I alone am the bastion between eternal existence and oblivion." }, "quote": "All mortals reek with the stench of decaying flesh."
{ "author": "Mordekaiser", "quote": "I carve my kingdom beyond, from the ashes of nothing, no mortals, not even gods, will stop me from claiming what is mine." }, },
{ "author": "Mordekaiser", "quote": "I have bent the realm of the dead to my will, this world shall be next." }, {
{ "author": "Mordekaiser", "quote": "I raise my iron fist to subjugate the living." }, "author": "Mordekaiser",
{ "author": "Mordekaiser", "quote": "I will grind their petty souls into mortar." }, "quote": "Fools fear death, the strong wield it."
{ "author": "Mordekaiser", "quote": "I will silence the incessant thrum of mortal hearts." }, },
{ "author": "Mordekaiser", "quote": "In the world beyond, blackened ichor filled a crumbling sky, as souls withered to nothing. But I refused to fade." }, {
{ "author": "Mordekaiser", "quote": "Mortals plan in fear for tomorrow, I build for eternity." }, "author": "Mordekaiser",
{ "author": "Mordekaiser", "quote": "Naive men pray to the gods; they will learn to pray to me." }, "quote": "I alone am the bastion between eternal existence and oblivion."
{ "author": "Mordekaiser", "quote": "Only the worthy receive the gift of Nightfall's kiss." }, },
{ "author": "Mordekaiser", "quote": "Shed the frailty of flesh, embrace the cold edge of iron." }, {
{ "author": "Mordekaiser", "quote": "The dead belong to me, the living shall be next." }, "author": "Mordekaiser",
{ "author": "Mordekaiser", "quote": "The world has tried to forget my existence, time to remind them why they fear." }, "quote": "I carve my kingdom beyond, from the ashes of nothing, no mortals, not even gods, will stop me from claiming what is mine."
},
{
"author": "Mordekaiser",
"quote": "I have bent the realm of the dead to my will, this world shall be next."
},
{
"author": "Mordekaiser",
"quote": "I raise my iron fist to subjugate the living."
},
{
"author": "Mordekaiser",
"quote": "I will grind their petty souls into mortar."
},
{
"author": "Mordekaiser",
"quote": "I will silence the incessant thrum of mortal hearts."
},
{
"author": "Mordekaiser",
"quote": "In the world beyond, blackened ichor filled a crumbling sky, as souls withered to nothing. But I refused to fade."
},
{
"author": "Mordekaiser",
"quote": "Mortals plan in fear for tomorrow, I build for eternity."
},
{
"author": "Mordekaiser",
"quote": "Naive men pray to the gods; they will learn to pray to me."
},
{
"author": "Mordekaiser",
"quote": "Only the worthy receive the gift of Nightfall's kiss."
},
{
"author": "Mordekaiser",
"quote": "Shed the frailty of flesh, embrace the cold edge of iron."
},
{
"author": "Mordekaiser",
"quote": "The dead belong to me, the living shall be next."
},
{
"author": "Mordekaiser",
"quote": "The world has tried to forget my existence, time to remind them why they fear."
},
{ "author": "Mordekaiser", "quote": "Twice slain, thrice born." }, { "author": "Mordekaiser", "quote": "Twice slain, thrice born." },
{ "author": "Mordekaiser", "quote": "Weaklings cower in the light, I bring eternal darkness." }, {
{ "author": "Poppy", "quote": "I'm in, one-hundred-percent! That's everything, right?" }, "author": "Mordekaiser",
"quote": "Weaklings cower in the light, I bring eternal darkness."
},
{
"author": "Poppy",
"quote": "I'm in, one-hundred-percent! That's everything, right?"
},
{ "author": "Poppy", "quote": "I'm no hero—just a Yordle with a hammer." }, { "author": "Poppy", "quote": "I'm no hero—just a Yordle with a hammer." },
{ "author": "Poppy", "quote": "Just had a thought—three pigtails!" }, { "author": "Poppy", "quote": "Just had a thought—three pigtails!" },
{ "author": "Poppy", "quote": "The hammer does most of the work, I just swing it." }, {
"author": "Poppy",
"quote": "The hammer does most of the work, I just swing it."
},
{ "author": "Rammus", "quote": "OK." }, { "author": "Rammus", "quote": "OK." },
{ "author": "Rammus", "quote": "🆗" }, { "author": "Rammus", "quote": "🆗" },
{ "author": "Senna", "quote": "I forgive. No one else has to." }, { "author": "Senna", "quote": "I forgive. No one else has to." },
{ "author": "Senna", "quote": "I remember my nightmares. Wish I could remember to dream." }, {
"author": "Senna",
"quote": "I remember my nightmares. Wish I could remember to dream."
},
{ "author": "Sion", "quote": "A black eye for the earth!" }, { "author": "Sion", "quote": "A black eye for the earth!" },
{ "author": "Sion", "quote": "Death had its chance." }, { "author": "Sion", "quote": "Death had its chance." },
{ "author": "Sion", "quote": "Noxus suffers no cowards." }, { "author": "Sion", "quote": "Noxus suffers no cowards." },
{ "author": "Sion", "quote": "The quiet... eats at me." }, { "author": "Sion", "quote": "The quiet... eats at me." },
{ "author": "Swain", "quote": "A calculated risk is no risk at all." }, { "author": "Swain", "quote": "A calculated risk is no risk at all." },
{ "author": "Swain", "quote": "A new vantage, is all the advantage I need." }, {
"author": "Swain",
"quote": "A new vantage, is all the advantage I need."
},
{ "author": "Swain", "quote": "And to think, they called me a 'cripple'." }, { "author": "Swain", "quote": "And to think, they called me a 'cripple'." },
{ "author": "Swain", "quote": "Destiny marches—like any man." }, { "author": "Swain", "quote": "Destiny marches—like any man." },
{ "author": "Swain", "quote": "Diplomacy is a subtle art." }, { "author": "Swain", "quote": "Diplomacy is a subtle art." },
{ "author": "Swain", "quote": "Hmph... I do so enjoy explaining things to idiots." }, {
{ "author": "Swain", "quote": "I cannot lead if I allow fools to stumble about before me." }, "author": "Swain",
{ "author": "Swain", "quote": "I could kill them all. But it would be far crueler to show them that I am right." }, "quote": "Hmph... I do so enjoy explaining things to idiots."
{ "author": "Swain", "quote": "I have killed more men with words than by my own hand. Not for lack of trying." }, },
{ "author": "Swain", "quote": "I suppose I should be grateful they have the decency to fear me." }, {
{ "author": "Swain", "quote": "I've heard what they call me. What a waste of their final words." }, "author": "Swain",
{ "author": "Swain", "quote": "If they already call me a villain, what will they call me when I succeed?" }, "quote": "I cannot lead if I allow fools to stumble about before me."
},
{
"author": "Swain",
"quote": "I could kill them all. But it would be far crueler to show them that I am right."
},
{
"author": "Swain",
"quote": "I have killed more men with words than by my own hand. Not for lack of trying."
},
{
"author": "Swain",
"quote": "I suppose I should be grateful they have the decency to fear me."
},
{
"author": "Swain",
"quote": "I've heard what they call me. What a waste of their final words."
},
{
"author": "Swain",
"quote": "If they already call me a villain, what will they call me when I succeed?"
},
{ "author": "Swain", "quote": "Is it not enough for Noxus to be strong?" }, { "author": "Swain", "quote": "Is it not enough for Noxus to be strong?" },
{ "author": "Swain", "quote": "It is not the visions that haunt me—but what I do not see." }, {
{ "author": "Swain", "quote": "Never make a bargain with a demon... that you intend to keep." }, "author": "Swain",
{ "author": "Swain", "quote": "One can read the future in battle lines, assuming one can read." }, "quote": "It is not the visions that haunt me—but what I do not see."
{ "author": "Swain", "quote": "People often ask for a hero, when a villain is what they truly need." }, },
{ "author": "Swain", "quote": "Pity stays the hand of the merciful, but not mine." }, {
{ "author": "Swain", "quote": "Tell me again all the crimes I've committed, and I'll tell you the price of victory." }, "author": "Swain",
{ "author": "Swain", "quote": "The more they try to kill me, the more they reveal I am on the right path." }, "quote": "Never make a bargain with a demon... that you intend to keep."
{ "author": "Swain", "quote": "The outcome was decided when they brought an army; and I brought a demon." }, },
{
"author": "Swain",
"quote": "One can read the future in battle lines, assuming one can read."
},
{
"author": "Swain",
"quote": "People often ask for a hero, when a villain is what they truly need."
},
{
"author": "Swain",
"quote": "Pity stays the hand of the merciful, but not mine."
},
{
"author": "Swain",
"quote": "Tell me again all the crimes I've committed, and I'll tell you the price of victory."
},
{
"author": "Swain",
"quote": "The more they try to kill me, the more they reveal I am on the right path."
},
{
"author": "Swain",
"quote": "The outcome was decided when they brought an army; and I brought a demon."
},
{ "author": "Swain", "quote": "The right to rule, held, in my hand." }, { "author": "Swain", "quote": "The right to rule, held, in my hand." },
{ "author": "Swain", "quote": "There is always a choice. The truth is no exception." }, {
{ "author": "Swain", "quote": "They are blind to the cold logic of this world." }, "author": "Swain",
{ "author": "Swain", "quote": "They are five steps from realizing: I am ten steps ahead." }, "quote": "There is always a choice. The truth is no exception."
{ "author": "Swain", "quote": "They expect me to play fairly... We aren't even playing the same game." }, },
{ "author": "Swain", "quote": "What is one more demon, when I already have so many?" }, {
{ "author": "Swain", "quote": "Would they even struggle to survive, if they knew what was to come?" }, "author": "Swain",
{ "author": "Swain", "quote": "You can sit on a throne, that doesn't make you a ruler. It only means you have an arse." }, "quote": "They are blind to the cold logic of this world."
{ "author": "Tahm Kench", "quote": "All creation is born famished and starving." }, },
{ "author": "Tahm Kench", "quote": "Child, you're a couple cows short of a steak!" }, {
{ "author": "Tahm Kench", "quote": "The only real sin is to deny a craving." }, "author": "Swain",
{ "author": "Tahm Kench", "quote": "We all gourmandize from time to time." }, "quote": "They are five steps from realizing: I am ten steps ahead."
},
{
"author": "Swain",
"quote": "They expect me to play fairly... We aren't even playing the same game."
},
{
"author": "Swain",
"quote": "What is one more demon, when I already have so many?"
},
{
"author": "Swain",
"quote": "Would they even struggle to survive, if they knew what was to come?"
},
{
"author": "Swain",
"quote": "You can sit on a throne, that doesn't make you a ruler. It only means you have an arse."
},
{
"author": "Tahm Kench",
"quote": "All creation is born famished and starving."
},
{
"author": "Tahm Kench",
"quote": "Child, you're a couple cows short of a steak!"
},
{
"author": "Tahm Kench",
"quote": "The only real sin is to deny a craving."
},
{
"author": "Tahm Kench",
"quote": "We all gourmandize from time to time."
},
{ "author": "Teemo", "quote": "Size doesn't mean everything." }, { "author": "Teemo", "quote": "Size doesn't mean everything." },
{ "author": "Thresh", "quote": "I am the thing under the bed." }, { "author": "Thresh", "quote": "I am the thing under the bed." },
{ "author": "Thresh", "quote": "Me, mad? Haha... quite likely." }, { "author": "Thresh", "quote": "Me, mad? Haha... quite likely." },
{ "author": "Urgot", "quote": "Cast into a pit of despair, I climbed out on the corpses." }, {
{ "author": "Urgot", "quote": "I am stronger than man, stronger than machine, I am an idea." }, "author": "Urgot",
{ "author": "Urgot", "quote": "I am the very definition of a self-made man." }, "quote": "Cast into a pit of despair, I climbed out on the corpses."
{ "author": "Urgot", "quote": "If they do not stop me, they will die. It is just that simple." }, },
{
"author": "Urgot",
"quote": "I am stronger than man, stronger than machine, I am an idea."
},
{
"author": "Urgot",
"quote": "I am the very definition of a self-made man."
},
{
"author": "Urgot",
"quote": "If they do not stop me, they will die. It is just that simple."
},
{ "author": "Urgot", "quote": "Pain is the act of becoming." }, { "author": "Urgot", "quote": "Pain is the act of becoming." },
{ "author": "Urgot", "quote": "We will rise from the rubble, stronger than before." }, {
{ "author": "Urgot", "quote": "You cannot know strength... Until you are broken." }, "author": "Urgot",
{ "author": "Veigar", "quote": "'It's only a short way'? Is that a short joke?!" }, "quote": "We will rise from the rubble, stronger than before."
},
{
"author": "Urgot",
"quote": "You cannot know strength... Until you are broken."
},
{
"author": "Veigar",
"quote": "'It's only a short way'? Is that a short joke?!"
},
{ "author": "Veigar", "quote": "I am evil! Stop laughing!" }, { "author": "Veigar", "quote": "I am evil! Stop laughing!" },
{ "author": "Veigar", "quote": "Know that if the tables were turned, I would show you no mercy!" }, {
{ "author": "Vex", "quote": "'Death is the true meaning of life.' Whoa! That's deep." }, "author": "Veigar",
{ "author": "Vex", "quote": "[Speaking to Lux] Oh, no. Happiness and rainbows? I'm gonna barf twice." }, "quote": "Know that if the tables were turned, I would show you no mercy!"
{ "author": "Vex", "quote": "And then I told her, 'Get outta my room!' And she said, 'This is my house, young lady and'... Oh, hang on, Shadow. I'll finish this later." }, },
{
"author": "Vex",
"quote": "'Death is the true meaning of life.' Whoa! That's deep."
},
{
"author": "Vex",
"quote": "[Speaking to Lux] Oh, no. Happiness and rainbows? I'm gonna barf twice."
},
{
"author": "Vex",
"quote": "And then I told her, 'Get outta my room!' And she said, 'This is my house, young lady and'... Oh, hang on, Shadow. I'll finish this later."
},
{ "author": "Vex", "quote": "Calm down, Shadow. I'm trying to sulk." }, { "author": "Vex", "quote": "Calm down, Shadow. I'm trying to sulk." },
{ "author": "Vex", "quote": "I am not cute. I am dark and forlorn and hopelessly morbid!" }, {
{ "author": "Vex", "quote": "I could start a club for people who hate people! Ehh, but no one would show up." }, "author": "Vex",
{ "author": "Vex", "quote": "This is going to be... awful, in a very good way. A good, awful way. You know what I mean!" }, "quote": "I am not cute. I am dark and forlorn and hopelessly morbid!"
{ "author": "Vex", "quote": "Welcome to Sad Town. Population: Me. Everyone else get out." }, },
{ "author": "Viktor", "quote": "All that is logical is true, absolute, irrefutable." }, {
{ "author": "Viktor", "quote": "Choice is false. It is how we clothe and forgive the baser instincts that spur us to division." }, "author": "Vex",
{ "author": "Viktor", "quote": "Emotion and logic cannot coexist. One must be shed to gain the other." }, "quote": "I could start a club for people who hate people! Ehh, but no one would show up."
},
{
"author": "Vex",
"quote": "This is going to be... awful, in a very good way. A good, awful way. You know what I mean!"
},
{
"author": "Vex",
"quote": "Welcome to Sad Town. Population: Me. Everyone else get out."
},
{
"author": "Viktor",
"quote": "All that is logical is true, absolute, irrefutable."
},
{
"author": "Viktor",
"quote": "Choice is false. It is how we clothe and forgive the baser instincts that spur us to division."
},
{
"author": "Viktor",
"quote": "Emotion and logic cannot coexist. One must be shed to gain the other."
},
{ "author": "Viktor", "quote": "Emotion... clashes with reason." }, { "author": "Viktor", "quote": "Emotion... clashes with reason." },
{ "author": "Viktor", "quote": "Governed by instinct, humans are no more than flawed and flailing animals." }, {
{ "author": "Viktor", "quote": "Hexcorization requires no justification. What purpose is there in explaining a horseshoe to the horse?" }, "author": "Viktor",
"quote": "Governed by instinct, humans are no more than flawed and flailing animals."
},
{
"author": "Viktor",
"quote": "Hexcorization requires no justification. What purpose is there in explaining a horseshoe to the horse?"
},
{ "author": "Viktor", "quote": "Humanity... is self-corrupting." }, { "author": "Viktor", "quote": "Humanity... is self-corrupting." },
{ "author": "Viktor", "quote": "I am not the man I was, but who I wished to be." }, {
{ "author": "Viktor", "quote": "I am the only one with the means to cure suffering. But it is a lonely path." }, "author": "Viktor",
{ "author": "Viktor", "quote": "I chose to become this. Difficulty had no bearing nor did danger. It was... necessary." }, "quote": "I am not the man I was, but who I wished to be."
{ "author": "Viktor", "quote": "I did not know true... beauty, until the Arcane." }, },
{
"author": "Viktor",
"quote": "I am the only one with the means to cure suffering. But it is a lonely path."
},
{
"author": "Viktor",
"quote": "I chose to become this. Difficulty had no bearing nor did danger. It was... necessary."
},
{
"author": "Viktor",
"quote": "I did not know true... beauty, until the Arcane."
},
{ "author": "Viktor", "quote": "I offer no choice, for there is none." }, { "author": "Viktor", "quote": "I offer no choice, for there is none." },
{ "author": "Viktor", "quote": "I sense... trepidation. But one cannot grow if left unchallenged." }, {
{ "author": "Viktor", "quote": "Mankind clings to its past. Glorifies its present. And lives in dread of tomorrow." }, "author": "Viktor",
{ "author": "Viktor", "quote": "Passion double-crosses, subverts, divides." }, "quote": "I sense... trepidation. But one cannot grow if left unchallenged."
},
{
"author": "Viktor",
"quote": "Mankind clings to its past. Glorifies its present. And lives in dread of tomorrow."
},
{
"author": "Viktor",
"quote": "Passion double-crosses, subverts, divides."
},
{ "author": "Viktor", "quote": "Sentiment is incompatible with control." }, { "author": "Viktor", "quote": "Sentiment is incompatible with control." },
{ "author": "Viktor", "quote": "So much of what we value is inconsequential." }, {
{ "author": "Viktor", "quote": "They think humanity can survive with emotion? Survive as what? Creatures blinded by impulse?" }, "author": "Viktor",
{ "author": "Viktor", "quote": "To live with flaws, is to be subject to them." }, "quote": "So much of what we value is inconsequential."
{ "author": "Viktor", "quote": "True change must be imposed, not offered." }, },
{ "author": "Viktor", "quote": "What I am doing is not torment. Torment is allowing the mind to corrupt the soul." }, {
"author": "Viktor",
"quote": "They think humanity can survive with emotion? Survive as what? Creatures blinded by impulse?"
},
{
"author": "Viktor",
"quote": "To live with flaws, is to be subject to them."
},
{
"author": "Viktor",
"quote": "True change must be imposed, not offered."
},
{
"author": "Viktor",
"quote": "What I am doing is not torment. Torment is allowing the mind to corrupt the soul."
},
{ "author": "Volibear", "quote": "A thousand scars, what is one more?" }, { "author": "Volibear", "quote": "A thousand scars, what is one more?" },
{ "author": "Volibear", "quote": "The creations of mortals fail. The wild remains." }, {
{ "author": "Volibear", "quote": "The land slumbers, but it is not dead. With my roar, I wake it. With my thunder, I call it." }, "author": "Volibear",
{ "author": "Volibear", "quote": "They have forgotten the old ways. The old ways have not forgotten them." }, "quote": "The creations of mortals fail. The wild remains."
{ "author": "Volibear", "quote": "Warm-bloods rose on two legs... and forgot how to run." }, },
{ "author": "Xerath", "quote": "I am power incarnate! Who dares oppose me?" }, {
"author": "Volibear",
"quote": "The land slumbers, but it is not dead. With my roar, I wake it. With my thunder, I call it."
},
{
"author": "Volibear",
"quote": "They have forgotten the old ways. The old ways have not forgotten them."
},
{
"author": "Volibear",
"quote": "Warm-bloods rose on two legs... and forgot how to run."
},
{
"author": "Xerath",
"quote": "I am power incarnate! Who dares oppose me?"
},
{ "author": "Xerath", "quote": "I am the will of man, unbound by flesh." }, { "author": "Xerath", "quote": "I am the will of man, unbound by flesh." },
{ "author": "Xerath", "quote": "I see the forces that hold the universe together." }, {
"author": "Xerath",
"quote": "I see the forces that hold the universe together."
},
{ "author": "Xerath", "quote": "The secrets of magic are mine alone." }, { "author": "Xerath", "quote": "The secrets of magic are mine alone." },
{ "author": "Yone", "quote": "Long before blades and sorcery are needed, words... can save a soul." }, {
{ "author": "Yone", "quote": "Sleep is not for the weak, but for the blessed." }, "author": "Yone",
{ "author": "Yone", "quote": "Sometimes, to save someone, you must fight them." } "quote": "Long before blades and sorcery are needed, words... can save a soul."
},
{
"author": "Yone",
"quote": "Sleep is not for the weak, but for the blessed."
},
{
"author": "Yone",
"quote": "Sometimes, to save someone, you must fight them."
}
] ]
} }

View File

@@ -1,9 +1,9 @@
import { Model, Sequelize, STRING } from "sequelize"; import {Model, Sequelize, STRING} from 'sequelize';
import "node:fs/promises"; import 'node:fs/promises';
import { readFile } from "node:fs"; import {readFile} from 'node:fs';
export const sql = new Sequelize("sqlite://./blitzcrank.sqlite"); export const sql = new Sequelize('sqlite://./blitzcrank.sqlite');
export class GuildSetting extends Model { export class GuildSetting extends Model {
declare guildId: string; declare guildId: string;
@@ -13,19 +13,19 @@ export class GuildSetting extends Model {
GuildSetting.init( GuildSetting.init(
{ {
guildId: { type: STRING }, guildId: {type: STRING},
key: { type: STRING }, key: {type: STRING},
value: { type: STRING }, value: {type: STRING},
}, },
{ sequelize: sql }, {sequelize: sql},
); );
export async function initDb() { export async function initDb() {
try { try {
await sql.authenticate(); await sql.authenticate();
console.log("Connected to database"); console.log('Connected to database');
} catch (error) { } catch (error) {
console.error("Unable to connect to the database:", error); console.error('Unable to connect to the database:', error);
} }
} }
@@ -43,10 +43,10 @@ export async function readSettingsFromFile(path: string) {
}); });
} }
} }
GuildSetting.bulkCreate(toInsert, { updateOnDuplicate: ["value"] }); GuildSetting.bulkCreate(toInsert, {updateOnDuplicate: ['value']});
} catch (error) { } catch (error) {
// TODO // TODO
console.log("Could not read settings:", error); console.log('Could not read settings:', error);
} }
}); });
} }

View File

@@ -1,11 +1,11 @@
import type { Interaction } from "discord.js"; import type {Interaction} from 'discord.js';
import { Client, Events, GatewayIntentBits, MessageFlags } from "discord.js"; import {Client, Events, GatewayIntentBits, MessageFlags} from 'discord.js';
import type { import type {
SlashCommandBuilder, SlashCommandBuilder,
SlashCommandOptionsOnlyBuilder, SlashCommandOptionsOnlyBuilder,
} from "discord.js"; } from 'discord.js';
import { sql, GuildSetting, initDb } from "./database"; import {sql, GuildSetting, initDb} from './database';
const BLITZCRANK_BANNER = ` const BLITZCRANK_BANNER = `
****++++++++++*+++ ****++++++++++*+++
@@ -71,9 +71,9 @@ const client = new Client({
], ],
}); });
import { Routes } from "discord.js"; import {Routes} from 'discord.js';
import { guildId, appId, token, remindersChannelId } from "./config.json"; import {guildId, appId, token, remindersChannelId} from './config.json';
import { REST } from "discord.js"; import {REST} from 'discord.js';
const rest = new REST(); const rest = new REST();
rest.setToken(token); rest.setToken(token);
@@ -84,26 +84,26 @@ interface Command {
initialize: (any) => Promise<void>; initialize: (any) => Promise<void>;
} }
import { Collection } from "discord.js"; import {Collection} from 'discord.js';
const commands = new Collection<string, Command>(); const commands = new Collection<string, Command>();
import PingCommand from "./commands/calendar/ping"; import PingCommand from './commands/calendar/ping';
import RemindCommand from "./commands/calendar/remind"; import RemindCommand from './commands/calendar/remind';
import QuoteCommand from "./commands/quotes/quote"; import QuoteCommand from './commands/quotes/quote';
console.debug(`${remindersChannelId}`); console.debug(`${remindersChannelId}`);
commands.set("ping", PingCommand({ client: client, db: sql })); commands.set('ping', PingCommand({client: client, db: sql}));
commands.set( commands.set(
"remind", 'remind',
RemindCommand({ RemindCommand({
client: client, client: client,
db: sql, db: sql,
publicChannel: remindersChannelId, publicChannel: remindersChannelId,
responseMode: "public", responseMode: 'public',
}), }),
); );
commands.set("quote", QuoteCommand({})); commands.set('quote', QuoteCommand({}));
async function syncCommands() { async function syncCommands() {
try { try {
@@ -111,7 +111,7 @@ async function syncCommands() {
const _data = await rest.put( const _data = await rest.put(
Routes.applicationGuildCommands(appId, guildId), Routes.applicationGuildCommands(appId, guildId),
{ {
body: commands.mapValues((cmd) => cmd.data.toJSON()), body: commands.mapValues(cmd => cmd.data.toJSON()),
}, },
); );
console.log(`Successfully reloaded slash commands`); console.log(`Successfully reloaded slash commands`);
@@ -135,7 +135,7 @@ client.on(Events.InteractionCreate, async (interaction: Interaction) => {
console.error(error); console.error(error);
if (interaction.replied || interaction.deferred) { if (interaction.replied || interaction.deferred) {
await interaction.followUp({ await interaction.followUp({
content: "There was an error while executing this command", content: 'There was an error while executing this command',
flags: MessageFlags.Ephemeral, flags: MessageFlags.Ephemeral,
}); });
} }
@@ -143,7 +143,7 @@ client.on(Events.InteractionCreate, async (interaction: Interaction) => {
// TODO // TODO
}); });
client.once(Events.ClientReady, async (readyClient) => { client.once(Events.ClientReady, async readyClient => {
await syncCommands(); await syncCommands();
initDb(); // TODO initDb(); // TODO
GuildSetting.sync(); // TODO GuildSetting.sync(); // TODO
@@ -155,7 +155,7 @@ client.once(Events.ClientReady, async (readyClient) => {
}); });
} }
// Print banner // Print banner
for (const ln of BLITZCRANK_BANNER.split("\n")) { for (const ln of BLITZCRANK_BANNER.split('\n')) {
console.log(ln); console.log(ln);
} }
console.log(`Logged in as ${readyClient.user.tag}`); console.log(`Logged in as ${readyClient.user.tag}`);