Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
feat(commands): add trigger command
Browse files Browse the repository at this point in the history
  • Loading branch information
Pukimaa committed Dec 11, 2021
1 parent 05a9e8d commit 76bf994
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/commands/trigger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageAttachment, MessageEmbed } = require('discord.js');
const { defaultColor } = require('../../config');

module.exports = {
data: new SlashCommandBuilder()
.setName('trigger')
.setDescription('"Trigger" an user or yourself')
.addUserOption(option => option.setName('user').setDescription('The user to trigger')),
async execute(interaction) {
const user = interaction.options.getUser('user') ? interaction.options.getUser('user') : interaction.user;
const image = new MessageAttachment(`https://some-random-api.ml/canvas/triggered?avatar=${user.displayAvatarURL({ size: 256, format: 'png' })}`, 'triggered.gif');

const embed = new MessageEmbed()
.setColor(defaultColor)
.setDescription(`**${user.username}** has been triggered!`)
.setImage('attachment://triggered.gif')
.setTimestamp();

await interaction.reply({ embeds: [embed], files: [image] });
},
};

0 comments on commit 76bf994

Please sign in to comment.