diff --git a/src/bot.ts b/src/bot.ts index 8f7f4e9..7a8f323 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -23,14 +23,14 @@ import {pagination} from "@devraelfreeze/discordjs-pagination"; export class Bot { public axiosClient; private static instance: Bot; + public client: Client; public init() { - const client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]}); + this.client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]}); this.axiosClient = axios.create({ baseURL: config.apiUrl, }); this.axiosClient.defaults.headers.common['x-api-key'] = config.apiKey; - this.registerCommands(); const commands: Collection = new Collection(); commands.set(Fact.data.name, Fact); @@ -41,15 +41,15 @@ export class Bot { commands.set(Facts.data.name, Facts); - client.once(Events.ClientReady, readyClient => { + this.client.once(Events.ClientReady, readyClient => { console.log(`Ready! Logged in as ${readyClient.user.tag}`); }); - client.on(Events.Error, (err) => { + this.client.on(Events.Error, (err) => { console.error(err); }); - client.on(Events.InteractionCreate, async interaction => { + this.client.on(Events.InteractionCreate, async interaction => { if (!interaction.isChatInputCommand()) return; const command = commands.get(interaction.commandName); @@ -76,7 +76,7 @@ export class Bot { } }); - client.login(config.token); + this.client.login(config.token); } private registerCommands() { diff --git a/src/commands/fact.ts b/src/commands/fact.ts index 53804e8..e013ae4 100644 --- a/src/commands/fact.ts +++ b/src/commands/fact.ts @@ -23,8 +23,16 @@ export default { const fact = response.data.fact; const embed = new EmbedBuilder() .setTitle('Random Fact') + .setAuthor({ + name: 'Beaver Facts', + iconURL: bot.client.emojis.cache.get('1237383875924197456').imageURL(), + }) .setDescription(fact.content) .setURL(fact.source) + .setFooter({ + text: 'ID: ' + fact.id + ' | Counter: ' + fact.counter, + iconURL: interaction.guild.iconURL(), + }) .setColor(0xffe600); console.log('Sent beaver fact with id: ' + fact.id);