feat(bot): make syntrel work in dms and group chats

This commit is contained in:
neoarz
2025-10-15 15:58:57 -04:00
parent 6a43c93637
commit cb1596a1d8
12 changed files with 41 additions and 5 deletions

View File

@@ -33,7 +33,7 @@
- [ ] Move all assets to gh
- [ ] Add codepreview for pull requests
- [x] Add codepreview for pull requests
- [x] Add try it and see command

View File

@@ -1,4 +1,5 @@
import discord
from discord import app_commands
from discord.ext import commands
from discord.ext.commands import Context
@@ -8,6 +9,9 @@ from .minesweeper import minesweeper_command
from .randomfact import randomfact_command
from .rockpaperscissors import rps_command
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Fun(commands.GroupCog, name="fun"):
def __init__(self, bot) -> None:
self.bot = bot
@@ -66,6 +70,8 @@ class Fun(commands.GroupCog, name="fun"):
name="coinflip",
description="Make a coin flip, but give your bet before."
)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
async def coinflip(self, context):
return await coinflip_command()(self, context)
@@ -74,6 +80,8 @@ class Fun(commands.GroupCog, name="fun"):
name="8ball",
description="Ask any question to the bot.",
)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
async def eight_ball(self, context, *, question: str):
return await eightball_command()(self, context, question=question)
@@ -82,11 +90,15 @@ class Fun(commands.GroupCog, name="fun"):
name="minesweeper",
description="Play a buttoned minesweeper mini-game."
)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
async def minesweeper(self, context):
return await minesweeper_command()(self, context)
@commands.check(_require_group_prefix)
@commands.hybrid_command(name="randomfact", description="Get a random fact.")
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
async def randomfact(self, context):
return await randomfact_command()(self, context)
@@ -94,6 +106,8 @@ class Fun(commands.GroupCog, name="fun"):
@commands.hybrid_command(
name="rps", description="Play the rock paper scissors game against the bot."
)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
async def rock_paper_scissors(self, context):
return await rps_command()(self, context)

View File

@@ -20,6 +20,9 @@ def _require_group_prefix(context: Context) -> bool:
content = context.message.content.strip().lower()
return content.startswith(f"{prefix}{group} ")
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class General(commands.GroupCog, name="general"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -9,6 +9,9 @@ from .developermode import developermode_command
from .noapps import noapps_command
from .mountddi import mountddi_command
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Idevice(commands.GroupCog, name="idevice"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -1,4 +1,5 @@
import discord
from discord import app_commands
from discord.ext import commands
from discord.ext.commands import Context
from typing import Optional
@@ -20,6 +21,9 @@ def _require_group_prefix(context: Context) -> bool:
content = context.message.content.strip().lower()
return content.startswith(f"{prefix}{group} ")
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Media(commands.GroupCog, name="media"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -11,6 +11,9 @@ from .requirements import requirements_command
from .error import error_command
from .ios26 import ios26_command
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Melonx(commands.GroupCog, name="melonx"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -1,4 +1,5 @@
import discord
from discord import app_commands
from discord.ext import commands
from discord.ext.commands import Context
@@ -13,6 +14,9 @@ from .support import support_command
from .docs import docs_command
from .sigma import sigma_command
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Miscellaneous(commands.GroupCog, name="misc"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -12,6 +12,9 @@ from .hackban import hackban_command
from .nick import nick_command
from .timeout import timeout_command
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Moderation(commands.GroupCog, name="moderation"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -14,6 +14,9 @@ from .udid import udid_command
from .half import half_command
from .sparse import sparse_command
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Sidestore(commands.GroupCog, name="sidestore"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -7,6 +7,9 @@ from .translate import translate_command, language_autocomplete
from .codepreview import codepreview_command
from .dictionary import dictionary_command
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
class Utilities(commands.GroupCog, name="utils"):
def __init__(self, bot) -> None:
self.bot = bot

View File

@@ -1,5 +1,3 @@
# Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn/Python-Discord-Bot-Template/blob/main/database/__init__.py
import aiosqlite

View File

@@ -1,5 +1,3 @@
-- Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn/Python-Discord-Bot-Template/blob/main/database/schema.sql
CREATE TABLE IF NOT EXISTS `warns` (
`id` int(11) NOT NULL,
`user_id` varchar(20) NOT NULL,