Skip to content

Commit

Permalink
[New] Added summon command to move your fav friend to your own channel!
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Aug 31, 2021
1 parent ad81cba commit fbe9d44
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions commands/misc/summon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { Permissions } = require("discord.js");
const { embedMessage } = require("../../modules/embedSimple");

module.exports = {
data: new SlashCommandBuilder()
.setName("summon")
.setDescription("ping the bot connection to the server")
.addUserOption((option) =>
option
.setName("user")
.setDescription("Select a user to summon!")
.setRequired(true)
),
async execute(interaction, client) {
await interaction.deferReply();
const user = interaction.options.getMember("user");
if (!interaction.member.permissions.has([Permissions.FLAGS.MOVE_MEMBERS]))
return await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
`❌ | You have no permission to summon users!`
),
],
});

if (!user.voice.channelId)
return await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
`${user.toString()} is not connected to any voice channel!`
),
],
});

try {
await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
`User ${user.toString()} has been moved to <#${
interaction.member.voice.channelId
}>`
),
],
});
await user.voice.setChannel(interaction.member.voice.channelId);
} catch (err) {
return await interaction.followUp(
`Something went wrong, I could not summon this user!`
);
}
},
};

0 comments on commit fbe9d44

Please sign in to comment.