Skip to content

Commit

Permalink
Merge pull request #105 from moeyashi/fix/20240422
Browse files Browse the repository at this point in the history
chore: ログ追加
  • Loading branch information
moeyashi authored Apr 22, 2024
2 parents 7b4d307 + 124d1e1 commit 53d8278
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/event/interaction-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const getCommands = async () => {
export default {
name: Events.InteractionCreate,
async execute(nitaRepository, interaction) {
console.info('InteractionCreate event triggered!');
if (!interaction.isChatInputCommand()) return;

const commands = await getCommands();
Expand Down
5 changes: 4 additions & 1 deletion src/event/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export default {
name: Events.ClientReady,
once: true,
execute: (_, client) => {
if (!client.isReady()) return;
if (!client.isReady()) {
console.error('The client is not ready!');
return;
}
console.log(`Ready! Logged in as ${client.user.tag}`);
},
};
9 changes: 7 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ const main = async () => {
}
console.info('Loaded events!');

// Log in to Discord with your client's token
await client.login(process.env.DISCORD_BOT_TOKEN);
try {
// Log in to Discord with your client's token
await client.login(process.env.DISCORD_BOT_TOKEN);
console.info('Logged in to Discord!');
} catch (error) {
console.error(`Failed to log in to Discord. ${error}`);
}
};

main();

0 comments on commit 53d8278

Please sign in to comment.