1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 18:23:12 +00:00

Start bridge commands

This commit is contained in:
wlinator 2024-03-16 15:05:40 +01:00
parent 7d2d8a9fd3
commit 2a86de5216
8 changed files with 28 additions and 8 deletions

BIN
art/mothra.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

BIN
art/mothra.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
art/mothra_transparent.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

BIN
art/mothra_transparent.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View file

@ -76,6 +76,7 @@ CREATE TABLE birthdays (
CREATE TABLE guild_config (
guild_id BIGINT NOT NULL,
prefix TINYTEXT,
birthday_channel_id BIGINT,
command_channel_id BIGINT, /* NULL: users can do XP & Currency commands everywhere. */
intro_channel_id BIGINT,

13
main.py
View file

@ -4,7 +4,7 @@ import sys
import traceback
import discord
from discord.ext import commands
from discord.ext import commands, bridge
from dotenv import load_dotenv
from lib import embeds
@ -17,8 +17,14 @@ from services.GuildConfig import GuildConfig
load_dotenv('.env')
instance = os.getenv("INSTANCE")
client = discord.Bot(
def get_prefix(bot, message):
return GuildConfig.get_prefix(message.guild.id)
client = bridge.Bot(
owner_id=os.getenv('OWNER_ID'),
command_prefix='!',
intents=discord.Intents.all(),
status=discord.Status.online
)
@ -137,9 +143,6 @@ async def on_application_command_error(ctx, error) -> None:
logs.error(f"[CommandHandler] on_application_command_error: {error}")
traceback.print_tb(error.original.__traceback__)
# if you use this, set "exc_info" to False above
# logs.debug(f"[CommandHandler] on_application_command_error (w/ stacktrace): {error}", exc_info=True)
@client.event
async def on_error(event: str, *args, **kwargs) -> None:

View file

@ -1,6 +1,6 @@
import logging
from discord.ext import commands
from discord.ext import commands, bridge
from main import strings
from lib import checks
@ -12,7 +12,7 @@ class PingCog(commands.Cog):
def __init__(self, client):
self.client = client
@commands.slash_command(
@bridge.bridge_command(
name="ping",
description="Simple status check.",
guild_only=True

View file

@ -67,4 +67,20 @@ class GuildConfig:
database.execute_query(query, (self.birthday_channel_id, self.command_channel_id,
self.intro_channel_id, self.welcome_channel_id, self.welcome_message,
self.level_channel_id, self.level_message,
self.level_message_type, self.guild_id))
self.level_message_type, self.guild_id))
@staticmethod
def get_prefix(guild_id):
"""
Gets the prefix from a given guild.
This function is done as static method to make the prefix fetch process faster.
"""
query = """
SELECT prefix
FROM guild_config
WHERE guild_id = %s
"""
prefix = database.select_query_one(query, (guild_id,))
return prefix if prefix else "."