edit fact embed
This commit is contained in:
parent
858343d7b0
commit
48c255ae8e
12
src/bot.ts
12
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<any, any> = 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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue