Skip to content

Commit

Permalink
add user mention when clicking truth and remove log message
Browse files Browse the repository at this point in the history
  • Loading branch information
FricoSimon committed Jul 24, 2023
1 parent 54c0e43 commit b3a3c50
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ client.on('ready', () => {
console.log(`Logged in as ${client.user.tag} successfully!`);
});

// Log messages to console
client.on('messageCreate', (message) => {
console.log(`${message.content} sent by ${message.author.username}`);
});

// main function
async function main() {
// register slash commands
Expand Down Expand Up @@ -183,6 +178,8 @@ client.on('interactionCreate', async (interaction) => {
const response = await axios.get('https://api.truthordarebot.xyz/v1/truth');
const data = response.data.question;
const username = interaction.user.username;
const userId = interaction.user.id;
const user = userMention(userId);

const embedReply = new EmbedBuilder()
.setTitle('You chose truth!')
Expand All @@ -192,7 +189,7 @@ client.on('interactionCreate', async (interaction) => {
.addFields({ name: 'Question', value: `${data}`, inline: true })
.setColor('#3ba55c');

await interaction.reply({ embeds: [embedReply] });
await interaction.reply({ content: `Answer this in 60s!\n${user}`, embeds: [embedReply] });
} catch (error) {
console.error(error);
await interaction.reply({ content: 'Error!' });
Expand All @@ -213,7 +210,7 @@ client.on('interactionCreate', async (interaction) => {
.addFields({ name: 'Order', value: `${data}`, inline: true })
.setColor('#FF5733');

await interaction.reply({ content: `Do this in 60s ${user}`, embeds: [embedReply] });
await interaction.reply({ content: `Do this in 60s!\n${user}`, embeds: [embedReply] });
} catch (error) {
console.error(error);
await interaction.reply({ content: 'Error!' });
Expand Down

0 comments on commit b3a3c50

Please sign in to comment.