mirror of
https://github.com/keanuplayz/TravBot-v3.git
synced 2024-08-15 02:33:12 +00:00
17 lines
517 B
TypeScript
17 lines
517 B
TypeScript
import {client} from "../index";
|
|
import {Storage} from "../structures";
|
|
import {Permissions} from "discord.js";
|
|
|
|
client.on("voiceStateUpdate", async (before, after) => {
|
|
const channel = before.channel;
|
|
const {channelNames} = Storage.getGuild(after.guild.id);
|
|
|
|
if (
|
|
channel &&
|
|
channel.members.size === 0 &&
|
|
channel.id in channelNames &&
|
|
before.guild.me?.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS)
|
|
) {
|
|
channel.setName(channelNames[channel.id]);
|
|
}
|
|
});
|