add greeting

add locales
This commit is contained in:
mo
2026-02-22 00:09:27 +01:00
parent 453577f1b2
commit bc0a6f2526
25 changed files with 183 additions and 449 deletions

View File

@@ -0,0 +1,50 @@
import type { VoiceChannelsServiceInterface } from "@avocadi/bot-core/entities/channels/voice/voice-channels.service";
import { config } from "config";
import { ChannelType, type VoiceChannel } from "discord.js";
import client from "lib/client";
export class VoiceChannelsService
implements VoiceChannelsServiceInterface<VoiceChannel>
{
async getVoiceChannelById(channelId: string) {
const channel = await client.channels.fetch(channelId);
if (!channel) {
throw new Error(`Channel with id ${channelId} not found`);
}
if (channel.type !== ChannelType.GuildVoice) {
throw new Error(`Channel with id ${channelId} is not a voice channel`);
}
return channel;
}
async createVoiceChannel(name: string) {
const guild = await client.guilds.fetch(config.guildId);
const channel = await guild.channels.create({
name,
type: ChannelType.GuildVoice,
});
return channel;
}
async cloneVoiceChannel(
channel: VoiceChannel,
options?: { name?: string; position?: number },
) {
const clonedChannel = await channel.clone({
name: options?.name,
position: options?.position,
});
return clonedChannel;
}
async deleteVoiceChannel(channelId: string) {
const channel = await this.getVoiceChannelById(channelId);
await channel.delete();
}
}
export const voiceChannelsService = new VoiceChannelsService();