2021-04-05 04:35:12 +00:00
|
|
|
import {Command, NamedCommand} 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 13:34:55 +00:00
|
|
|
async run({send, message, channel, guild, author, member, client, args}) {
|
2021-04-05 04:35:12 +00:00
|
|
|
const voiceChannel = message.member?.voice.channel;
|
2020-12-15 01:44:28 +00:00
|
|
|
|
2021-04-10 13:34:55 +00:00
|
|
|
if (!voiceChannel) return send("You are not in a voice channel.");
|
2021-04-06 06:15:17 +00:00
|
|
|
if (!voiceChannel.guild.me?.hasPermission("MANAGE_CHANNELS"))
|
2021-04-10 13:34:55 +00:00
|
|
|
return send("I am lacking the required permissions to perform this action.");
|
|
|
|
if (args.length === 0) return send("Please provide a new voice channel name.");
|
2020-12-15 01:44:28 +00:00
|
|
|
|
2021-01-29 16:21:06 +00:00
|
|
|
const prevName = voiceChannel.name;
|
2021-04-05 04:35:12 +00:00
|
|
|
const newName = args.join(" ");
|
2021-01-29 16:21:06 +00:00
|
|
|
await voiceChannel.setName(newName);
|
2021-04-10 13:34:55 +00:00
|
|
|
return await send(`Changed channel name from "${prevName}" to "${newName}".`);
|
2020-10-22 14:24:58 +00:00
|
|
|
}
|
2020-12-15 01:44:28 +00:00
|
|
|
});
|