TravBot-v3/src/commands/utility/desc.ts

22 lines
850 B
TypeScript
Raw Normal View History

import {NamedCommand, RestCommand} from "onion-lasers";
export default new NamedCommand({
description: "Renames current voice channel.",
usage: "<name>",
run: "Please provide a new voice channel name.",
any: new RestCommand({
async run({send, message, combined}) {
const voiceChannel = message.member?.voice.channel;
2020-12-15 01:44:28 +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
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
});