-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[New] Added summon command to move your fav friend to your own channel!
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!` | ||
); | ||
} | ||
}, | ||
}; |