chore(auto): task completed - unknown
This commit is contained in:
@@ -27,9 +27,7 @@ export function createGuildsRouter(): Router {
|
|||||||
router.get(
|
router.get(
|
||||||
"/:guildId/channels",
|
"/:guildId/channels",
|
||||||
asyncHandler(async (req: Request, res: Response) => {
|
asyncHandler(async (req: Request, res: Response) => {
|
||||||
const guildId = Array.isArray(req.params.guildId)
|
const guildId = req.params.guildId;
|
||||||
? req.params.guildId[0]
|
|
||||||
: req.params.guildId;
|
|
||||||
logger.debug({ guildId }, "Fetching text channels");
|
logger.debug({ guildId }, "Fetching text channels");
|
||||||
const channels = await getTextChannels(guildId);
|
const channels = await getTextChannels(guildId);
|
||||||
res.json(channels);
|
res.json(channels);
|
||||||
@@ -40,9 +38,7 @@ export function createGuildsRouter(): Router {
|
|||||||
router.get(
|
router.get(
|
||||||
"/:guildId/voice-channels",
|
"/:guildId/voice-channels",
|
||||||
asyncHandler(async (req: Request, res: Response) => {
|
asyncHandler(async (req: Request, res: Response) => {
|
||||||
const guildId = Array.isArray(req.params.guildId)
|
const guildId = req.params.guildId;
|
||||||
? req.params.guildId[0]
|
|
||||||
: req.params.guildId;
|
|
||||||
logger.debug({ guildId }, "Fetching voice channels");
|
logger.debug({ guildId }, "Fetching voice channels");
|
||||||
const channels = await getVoiceChannels(guildId);
|
const channels = await getVoiceChannels(guildId);
|
||||||
res.json(channels);
|
res.json(channels);
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
import { z } from "zod";
|
|
||||||
|
|
||||||
export const voiceCommandSchema = z.object({
|
|
||||||
command: z.string().min(1, "command is required"),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const connectVoiceSchema = z.object({
|
|
||||||
guildId: z.string().min(1, "guildId is required"),
|
|
||||||
channelId: z.string().min(1, "channelId is required"),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const guildIdParamSchema = z.object({
|
|
||||||
guildId: z.string().min(1),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const guildSchema = z.object({
|
|
||||||
id: z.string(),
|
|
||||||
name: z.string(),
|
|
||||||
icon: z.string().nullable(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const channelSchema = z.object({
|
|
||||||
id: z.string(),
|
|
||||||
name: z.string(),
|
|
||||||
type: z.enum(["voice", "text"]),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const voiceStatusSchema = z.object({
|
|
||||||
connected: z.boolean(),
|
|
||||||
activeGuildId: z.string().nullable(),
|
|
||||||
activeChannelId: z.string().nullable(),
|
|
||||||
activeChannelName: z.string().nullable(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export type VoiceCommand = z.infer<typeof voiceCommandSchema>;
|
|
||||||
export type ConnectVoice = z.infer<typeof connectVoiceSchema>;
|
|
||||||
export type Guild = z.infer<typeof guildSchema>;
|
|
||||||
export type Channel = z.infer<typeof channelSchema>;
|
|
||||||
export type VoiceStatus = z.infer<typeof voiceStatusSchema>;
|
|
||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
COMMAND_VOICE_CHANNELS,
|
COMMAND_VOICE_CHANNELS,
|
||||||
COMMAND_VOICE_CONNECT,
|
COMMAND_VOICE_CONNECT,
|
||||||
COMMAND_VOICE_DISCONNECT,
|
COMMAND_VOICE_DISCONNECT,
|
||||||
COMMAND_VOICE_DISCONNECT_GUILD,
|
|
||||||
CommandReply,
|
CommandReply,
|
||||||
VOICE_STATUS_KEY,
|
VOICE_STATUS_KEY,
|
||||||
} from "@bete/shared";
|
} from "@bete/shared";
|
||||||
@@ -168,17 +167,3 @@ export async function disconnectVoice(): Promise<VoiceStatus> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Disconnect from a specific guild's voice channel.
|
|
||||||
*/
|
|
||||||
export async function disconnectVoiceGuild(
|
|
||||||
guildId: string,
|
|
||||||
): Promise<VoiceStatus> {
|
|
||||||
logger.info({ guildId }, "disconnectVoiceGuild called");
|
|
||||||
return withFallback(
|
|
||||||
() =>
|
|
||||||
publishCommand<VoiceStatus>(COMMAND_VOICE_DISCONNECT_GUILD, { guildId }),
|
|
||||||
() => readVoiceStatusFallback(),
|
|
||||||
"disconnectVoiceGuild",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user