2021-04-11 09:11:21 +00:00
|
|
|
import {NamedCommand, RestCommand} from "../../core";
|
2020-10-22 14:24:58 +00:00
|
|
|
|
2021-04-05 04:35:12 +00:00
|
|
|
export default new NamedCommand({
|
2020-10-22 14:24:58 +00:00
|
|
|
description: "Renames current voice channel.",
|
|
|
|
usage: "<name>",
|
2021-04-10 17:07:55 +00:00
|
|
|
run: "Please provide a new voice channel name.",
|
|
|
|
any: new RestCommand({
|
2021-04-11 09:11:21 +00:00
|
|
|
async run({send, message, combined}) {
|
2021-04-10 17:07:55 +00:00
|
|
|
const voiceChannel = message.member?.voice.channel;
|
2020-12-15 01:44:28 +00:00
|
|
|
|
2021-04-10 17:07:55 +00:00
|
|
|
if (!voiceChannel) return send("You are not in a voice channel.");
|
|
|
|
if (!voiceChannel.guild.me?.hasPermission("MANAGE_CHANNELS"))
|
|
|
|
return send("I am lacking the required permissions to perform this action.");
|
2020-12-15 01:44:28 +00:00
|
|
|
|
2021-04-10 17:07:55 +00:00
|
|
|
const prevName = voiceChannel.name;
|
|
|
|
const newName = combined;
|
|
|
|
await voiceChannel.setName(newName);
|
|
|
|
return await send(`Changed channel name from "${prevName}" to "${newName}".`);
|
|
|
|
}
|
|
|
|
})
|
2020-12-15 01:44:28 +00:00
|
|
|
});
|