Added request song channel feature

This commit is contained in:
Choco
2024-12-05 13:33:29 +08:00
parent 7c56fc960f
commit 94c5fd4c27
15 changed files with 155 additions and 57 deletions

15
main.py
View File

@@ -4,6 +4,7 @@ import os
import aiohttp
import update
import logging
import voicelink
import function as func
from discord.ext import commands
@@ -41,6 +42,20 @@ class Vocard(commands.Bot):
return await message.channel.send("I don't have a bot prefix set.")
await message.channel.send(f"My prefix is `{prefix}`")
settings = await func.get_settings(message.guild.id)
if settings and (request_channel := settings.get("music_request_channel")):
if message.channel.id == request_channel.get("text_channel_id"):
try:
ctx = await self.get_context(message)
cmd = self.get_command("play")
await cmd(ctx, query=message.content)
except Exception as e:
await func.send(ctx, str(e), ephemeral=True)
finally:
return await message.delete()
await self.process_commands(message)
async def connect_db(self) -> None: