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

Merge pull request #47 from wlinator/replace-commands-bot

chore: Replace `commands.Bot` with `Luminara` wherever possible
This commit is contained in:
wlinator 2024-09-03 03:50:01 -04:00 committed by GitHub
commit f427a79f5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 179 additions and 142 deletions

View file

@ -8,6 +8,7 @@ from discord.ext import commands
from loguru import logger from loguru import logger
from lib import exceptions from lib import exceptions
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
error_map: dict[type[Exception], str] = { error_map: dict[type[Exception], str] = {
@ -51,7 +52,7 @@ async def log_command_error(
class ErrorHandler(commands.Cog): class ErrorHandler(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot = bot self.bot = bot
async def cog_load(self): async def cog_load(self):
@ -85,7 +86,7 @@ class ErrorHandler(commands.Cog):
@commands.Cog.listener() @commands.Cog.listener()
async def on_command_error( async def on_command_error(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
error: commands.CommandError | commands.CheckFailure, error: commands.CommandError | commands.CheckFailure,
) -> None: ) -> None:
if isinstance(error, commands.CommandNotFound | exceptions.Blacklisted): if isinstance(error, commands.CommandNotFound | exceptions.Blacklisted):
@ -107,5 +108,5 @@ class ErrorHandler(commands.Cog):
await on_error(event, *args, **kwargs) await on_error(event, *args, **kwargs)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(ErrorHandler(bot)) await bot.add_cog(ErrorHandler(bot))

View file

@ -2,13 +2,14 @@ import discord
from discord.ext import commands from discord.ext import commands
from loguru import logger from loguru import logger
from lib.client import Luminara
from services.blacklist_service import BlacklistUserService from services.blacklist_service import BlacklistUserService
from services.config_service import GuildConfig from services.config_service import GuildConfig
from ui.config import create_boost_embed, create_greet_embed from ui.config import create_boost_embed, create_greet_embed
class EventHandler(commands.Cog): class EventHandler(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
@commands.Cog.listener() @commands.Cog.listener()
@ -76,7 +77,7 @@ class EventHandler(commands.Cog):
) )
@commands.Cog.listener() @commands.Cog.listener()
async def on_command_completion(self, ctx: commands.Context[commands.Bot]) -> None: async def on_command_completion(self, ctx: commands.Context[Luminara]) -> None:
log_msg = f"{ctx.author.name} executed .{ctx.command.qualified_name if ctx.command else 'Unknown'}" log_msg = f"{ctx.author.name} executed .{ctx.command.qualified_name if ctx.command else 'Unknown'}"
if ctx.guild is not None: if ctx.guild is not None:
@ -94,5 +95,5 @@ class EventHandler(commands.Cog):
logger.debug(f"{log_msg} in DMs") logger.debug(f"{log_msg} in DMs")
async def setup(bot: commands.Bot): async def setup(bot: Luminara):
await bot.add_cog(EventHandler(bot)) await bot.add_cog(EventHandler(bot))

View file

@ -2,6 +2,7 @@ import discord
from discord.ext import commands from discord.ext import commands
from loguru import logger from loguru import logger
from lib.client import Luminara
from lib.exceptions import LumiException from lib.exceptions import LumiException
from services.case_service import CaseService from services.case_service import CaseService
from services.modlog_service import ModLogService from services.modlog_service import ModLogService
@ -12,7 +13,7 @@ modlog_service = ModLogService()
async def create_case( async def create_case(
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.User, target: discord.User,
action_type: str, action_type: str,
reason: str | None = None, reason: str | None = None,
@ -93,7 +94,7 @@ async def create_case(
async def edit_case_modlog( async def edit_case_modlog(
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
guild_id: int, guild_id: int,
case_number: int, case_number: int,
new_reason: str, new_reason: str,

View file

@ -7,6 +7,7 @@ from discord.ext import commands
from pytimeparse import parse # type: ignore from pytimeparse import parse # type: ignore
from lib import exceptions from lib import exceptions
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.config_service import GuildConfig from services.config_service import GuildConfig
@ -76,7 +77,7 @@ def format_case_number(case_number: int) -> str:
return f"{case_number:03d}" if case_number < 1000 else str(case_number) return f"{case_number:03d}" if case_number < 1000 else str(case_number)
def get_prefix(ctx: commands.Context[commands.Bot]) -> str: def get_prefix(ctx: commands.Context[Luminara]) -> str:
""" """
Attempts to retrieve the prefix for the given guild context. Attempts to retrieve the prefix for the given guild context.
@ -92,7 +93,7 @@ def get_prefix(ctx: commands.Context[commands.Bot]) -> str:
return "." return "."
def get_invoked_name(ctx: commands.Context[commands.Bot]) -> str | None: def get_invoked_name(ctx: commands.Context[Luminara]) -> str | None:
""" """
Attempts to get the alias of the command used. If the user used a SlashCommand, return the command name. Attempts to get the alias of the command used. If the user used a SlashCommand, return the command name.

View file

@ -3,13 +3,14 @@ from discord.ext import commands
import lib.format import lib.format
from db import database from db import database
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.format import shorten from lib.format import shorten
from ui.embeds import Builder from ui.embeds import Builder
class Sql(commands.Cog): class Sql(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.select_cmd.usage = lib.format.generate_usage(self.select_cmd) self.select_cmd.usage = lib.format.generate_usage(self.select_cmd)
self.inject_cmd.usage = lib.format.generate_usage(self.inject_cmd) self.inject_cmd.usage = lib.format.generate_usage(self.inject_cmd)
@ -18,7 +19,7 @@ class Sql(commands.Cog):
@commands.is_owner() @commands.is_owner()
async def select_cmd( async def select_cmd(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
*, *,
query: str, query: str,
) -> None: ) -> None:
@ -27,7 +28,7 @@ class Sql(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
query : str query : str
The SQL query to execute. The SQL query to execute.
@ -65,7 +66,7 @@ class Sql(commands.Cog):
@commands.is_owner() @commands.is_owner()
async def inject_cmd( async def inject_cmd(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
*, *,
query: str, query: str,
) -> None: ) -> None:
@ -74,7 +75,7 @@ class Sql(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
query : str query : str
The SQL query to execute. The SQL query to execute.
@ -105,5 +106,5 @@ class Sql(commands.Cog):
await ctx.send(embed=embed, ephemeral=True) await ctx.send(embed=embed, ephemeral=True)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Sql(bot)) await bot.add_cog(Sql(bot))

View file

@ -2,13 +2,14 @@ import discord
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.currency_service import Currency from services.currency_service import Currency
from ui.embeds import Builder from ui.embeds import Builder
class Award(commands.Cog): class Award(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.award_command.usage = lib.format.generate_usage(self.award_command) self.award_command.usage = lib.format.generate_usage(self.award_command)
@ -16,7 +17,7 @@ class Award(commands.Cog):
@commands.is_owner() @commands.is_owner()
async def award_command( async def award_command(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
user: discord.User, user: discord.User,
amount: int, amount: int,
) -> None: ) -> None:
@ -25,7 +26,7 @@ class Award(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
user : discord.User user : discord.User
The user to award. The user to award.
@ -49,5 +50,5 @@ class Award(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Award(bot)) await bot.add_cog(Award(bot))

View file

@ -2,13 +2,14 @@ import discord
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.blacklist_service import BlacklistUserService from services.blacklist_service import BlacklistUserService
from ui.embeds import Builder from ui.embeds import Builder
class Blacklist(commands.Cog): class Blacklist(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.blacklist_command.usage = lib.format.generate_usage(self.blacklist_command) self.blacklist_command.usage = lib.format.generate_usage(self.blacklist_command)
@ -16,7 +17,7 @@ class Blacklist(commands.Cog):
@commands.is_owner() @commands.is_owner()
async def blacklist_command( async def blacklist_command(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
user: discord.User, user: discord.User,
*, *,
reason: str | None = None, reason: str | None = None,
@ -26,7 +27,7 @@ class Blacklist(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
user : discord.User user : discord.User
The user to blacklist. The user to blacklist.
@ -47,5 +48,5 @@ class Blacklist(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Blacklist(bot)) await bot.add_cog(Blacklist(bot))

View file

@ -35,7 +35,7 @@ class Dev(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
guild : discord.Guild | None, optional guild : discord.Guild | None, optional
The guild to sync the tree to, by default None. The guild to sync the tree to, by default None.
@ -61,7 +61,7 @@ class Dev(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
guild : discord.Guild | None, optional guild : discord.Guild | None, optional
""" """

View file

@ -10,6 +10,7 @@ from discord.ext import commands, tasks
from loguru import logger from loguru import logger
from lib.checks import birthdays_enabled from lib.checks import birthdays_enabled
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.birthday_service import BirthdayService from services.birthday_service import BirthdayService
from services.config_service import GuildConfig from services.config_service import GuildConfig
@ -19,7 +20,7 @@ from ui.embeds import Builder
@app_commands.guild_only() @app_commands.guild_only()
@app_commands.default_permissions(manage_guild=True) @app_commands.default_permissions(manage_guild=True)
class Birthday(commands.GroupCog, group_name="birthday"): class Birthday(commands.GroupCog, group_name="birthday"):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.daily_birthday_check.start() self.daily_birthday_check.start()
@ -207,5 +208,5 @@ class Birthday(commands.GroupCog, group_name="birthday"):
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Birthday(bot)) await bot.add_cog(Birthday(bot))

View file

@ -3,6 +3,7 @@ from discord import app_commands
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from services.config_service import GuildConfig from services.config_service import GuildConfig
@ -15,7 +16,7 @@ from ui.embeds import Builder
@app_commands.guild_only() @app_commands.guild_only()
@app_commands.default_permissions(administrator=True) @app_commands.default_permissions(administrator=True)
class Config(commands.GroupCog, group_name="config"): class Config(commands.GroupCog, group_name="config"):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
birthdays = app_commands.Group(name="birthdays", description="Configure the birthdays module") birthdays = app_commands.Group(name="birthdays", description="Configure the birthdays module")
@ -793,5 +794,5 @@ class Config(commands.GroupCog, group_name="config"):
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Config(bot)) await bot.add_cog(Config(bot))

View file

@ -1,14 +1,15 @@
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.currency_service import Currency from services.currency_service import Currency
from ui.embeds import Builder from ui.embeds import Builder
class Balance(commands.Cog): class Balance(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.balance.usage = lib.format.generate_usage(self.balance) self.balance.usage = lib.format.generate_usage(self.balance)
@commands.hybrid_command( @commands.hybrid_command(
@ -18,14 +19,14 @@ class Balance(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def balance( async def balance(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
) -> None: ) -> None:
""" """
Check your current balance. Check your current balance.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
@ -46,5 +47,5 @@ class Balance(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Balance(bot)) await bot.add_cog(Balance(bot))

View file

@ -6,6 +6,7 @@ from discord.ext import commands
from loguru import logger from loguru import logger
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from services.currency_service import Currency from services.currency_service import Currency
@ -21,8 +22,8 @@ Hand = list[Card]
class Blackjack(commands.Cog): class Blackjack(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.blackjack.usage = lib.format.generate_usage(self.blackjack) self.blackjack.usage = lib.format.generate_usage(self.blackjack)
@commands.hybrid_command( @commands.hybrid_command(
@ -32,7 +33,7 @@ class Blackjack(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def blackjack( async def blackjack(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
bet: int, bet: int,
) -> None: ) -> None:
""" """
@ -40,7 +41,7 @@ class Blackjack(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
bet : int bet : int
The amount to bet. The amount to bet.
@ -64,7 +65,7 @@ class Blackjack(commands.Cog):
finally: finally:
del ACTIVE_BLACKJACK_GAMES[ctx.author.id] del ACTIVE_BLACKJACK_GAMES[ctx.author.id]
async def play_blackjack(self, ctx: commands.Context[commands.Bot], currency: Currency, bet: int) -> None: async def play_blackjack(self, ctx: commands.Context[Luminara], currency: Currency, bet: int) -> None:
deck = self.get_new_deck() deck = self.get_new_deck()
player_hand, dealer_hand = self.initial_deal(deck) player_hand, dealer_hand = self.initial_deal(deck)
multiplier = CONST.BLACKJACK_MULTIPLIER multiplier = CONST.BLACKJACK_MULTIPLIER
@ -136,7 +137,7 @@ class Blackjack(commands.Cog):
async def handle_game_end( async def handle_game_end(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
response_message: discord.Message | None, response_message: discord.Message | None,
currency: Currency, currency: Currency,
bet: int, bet: int,
@ -175,7 +176,7 @@ class Blackjack(commands.Cog):
def create_game_embed( def create_game_embed(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
bet: int, bet: int,
player_hand: Hand, player_hand: Hand,
dealer_hand: Hand, dealer_hand: Hand,
@ -209,7 +210,7 @@ class Blackjack(commands.Cog):
def create_end_game_embed( def create_end_game_embed(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
bet: int, bet: int,
player_value: int, player_value: int,
dealer_value: int, dealer_value: int,
@ -299,5 +300,5 @@ class Blackjack(commands.Cog):
return value return value
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Blackjack(bot)) await bot.add_cog(Blackjack(bot))

View file

@ -5,6 +5,7 @@ from discord import Embed
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.currency_service import Currency from services.currency_service import Currency
from services.daily_service import Dailies from services.daily_service import Dailies
@ -24,8 +25,8 @@ def seconds_until(hours: int, minutes: int) -> int:
class Daily(commands.Cog): class Daily(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.daily.usage = lib.format.generate_usage(self.daily) self.daily.usage = lib.format.generate_usage(self.daily)
@commands.hybrid_command( @commands.hybrid_command(
@ -35,14 +36,14 @@ class Daily(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def daily( async def daily(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
) -> None: ) -> None:
""" """
Claim your daily reward. Claim your daily reward.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
ctx_daily: Dailies = Dailies(ctx.author.id) ctx_daily: Dailies = Dailies(ctx.author.id)
@ -81,5 +82,5 @@ class Daily(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Daily(bot)) await bot.add_cog(Daily(bot))

View file

@ -2,6 +2,7 @@ import discord
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from services.currency_service import Currency from services.currency_service import Currency
@ -9,8 +10,8 @@ from ui.embeds import Builder
class Give(commands.Cog): class Give(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.give.usage = lib.format.generate_usage(self.give) self.give.usage = lib.format.generate_usage(self.give)
@commands.hybrid_command( @commands.hybrid_command(
@ -19,7 +20,7 @@ class Give(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def give( async def give(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
user: discord.User, user: discord.User,
amount: int, amount: int,
) -> None: ) -> None:
@ -28,7 +29,7 @@ class Give(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
user : discord.User user : discord.User
The user to give currency to. The user to give currency to.
@ -66,5 +67,5 @@ class Give(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Give(bot)) await bot.add_cog(Give(bot))

View file

@ -8,6 +8,7 @@ import discord
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from services.currency_service import Currency from services.currency_service import Currency
@ -17,8 +18,8 @@ est = ZoneInfo("US/Eastern")
class Slots(commands.Cog): class Slots(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.slots.usage = lib.format.generate_usage(self.slots) self.slots.usage = lib.format.generate_usage(self.slots)
@commands.hybrid_command( @commands.hybrid_command(
@ -28,7 +29,7 @@ class Slots(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def slots( async def slots(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
bet: int, bet: int,
) -> None: ) -> None:
""" """
@ -36,7 +37,7 @@ class Slots(commands.Cog):
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
bet : int bet : int
The amount to bet. The amount to bet.
@ -134,7 +135,7 @@ class Slots(commands.Cog):
def slots_spinning( def slots_spinning(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
spinning_icons_amount: int, spinning_icons_amount: int,
bet: str, bet: str,
results: list[int], results: list[int],
@ -179,7 +180,7 @@ class Slots(commands.Cog):
def slots_finished( def slots_finished(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
payout_type: str, payout_type: str,
bet: str, bet: str,
payout: str, payout: str,
@ -251,5 +252,5 @@ class Slots(commands.Cog):
return embed return embed
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Slots(bot)) await bot.add_cog(Slots(bot))

View file

@ -4,27 +4,28 @@ from discord import Embed, Guild, Member
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
from ui.views.leaderboard import LeaderboardCommandOptions, LeaderboardCommandView from ui.views.leaderboard import LeaderboardCommandOptions, LeaderboardCommandView
class Leaderboard(commands.Cog): class Leaderboard(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.leaderboard.usage = lib.format.generate_usage(self.leaderboard) self.leaderboard.usage = lib.format.generate_usage(self.leaderboard)
@commands.hybrid_command( @commands.hybrid_command(
name="leaderboard", name="leaderboard",
aliases=["lb"], aliases=["lb"],
) )
async def leaderboard(self, ctx: commands.Context[commands.Bot]) -> None: async def leaderboard(self, ctx: commands.Context[Luminara]) -> None:
""" """
Get the leaderboard for the server. Get the leaderboard for the server.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
guild: Guild | None = ctx.guild guild: Guild | None = ctx.guild
@ -48,5 +49,5 @@ class Leaderboard(commands.Cog):
await ctx.send(embed=embed, view=view) await ctx.send(embed=embed, view=view)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Leaderboard(bot)) await bot.add_cog(Leaderboard(bot))

View file

@ -2,13 +2,14 @@ from discord import Embed
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.xp_service import XpService from services.xp_service import XpService
from ui.embeds import Builder from ui.embeds import Builder
class Level(commands.Cog): class Level(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.level.usage = lib.format.generate_usage(self.level) self.level.usage = lib.format.generate_usage(self.level)
@ -16,13 +17,13 @@ class Level(commands.Cog):
name="level", name="level",
aliases=["rank", "lvl", "xp"], aliases=["rank", "lvl", "xp"],
) )
async def level(self, ctx: commands.Context[commands.Bot]) -> None: async def level(self, ctx: commands.Context[Luminara]) -> None:
""" """
Get the level of the user. Get the level of the user.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
if not ctx.guild: if not ctx.guild:
@ -52,5 +53,5 @@ class Level(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Level(bot)) await bot.add_cog(Level(bot))

View file

@ -6,6 +6,7 @@ from discord import File
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
async def create_avatar_file(url: str) -> File: async def create_avatar_file(url: str) -> File:
@ -32,7 +33,7 @@ async def create_avatar_file(url: str) -> File:
class Avatar(commands.Cog): class Avatar(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.avatar.usage = lib.format.generate_usage(self.avatar) self.avatar.usage = lib.format.generate_usage(self.avatar)
@ -42,7 +43,7 @@ class Avatar(commands.Cog):
) )
async def avatar( async def avatar(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
member: discord.Member | None = None, member: discord.Member | None = None,
) -> None: ) -> None:
""" """
@ -69,5 +70,5 @@ class Avatar(commands.Cog):
await ctx.send(content="member has no avatar.") await ctx.send(content="member has no avatar.")
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Avatar(bot)) await bot.add_cog(Avatar(bot))

View file

@ -9,6 +9,7 @@ from discord.ext import commands, tasks
from dropbox.files import FileMetadata # type: ignore from dropbox.files import FileMetadata # type: ignore
from loguru import logger from loguru import logger
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
# Initialize Dropbox client if instance is "main" # Initialize Dropbox client if instance is "main"
@ -77,8 +78,8 @@ async def backup() -> None:
class Backup(commands.Cog): class Backup(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.do_backup.start() self.do_backup.start()
@tasks.loop(hours=1) @tasks.loop(hours=1)
@ -91,5 +92,5 @@ class Backup(commands.Cog):
await asyncio.sleep(30) await asyncio.sleep(30)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Backup(bot)) await bot.add_cog(Backup(bot))

View file

@ -6,19 +6,20 @@ import psutil
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
class Info(commands.Cog): class Info(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.info.usage = lib.format.generate_usage(self.info) self.info.usage = lib.format.generate_usage(self.info)
@commands.hybrid_command( @commands.hybrid_command(
name="info", name="info",
) )
async def info(self, ctx: commands.Context[commands.Bot]) -> None: async def info(self, ctx: commands.Context[Luminara]) -> None:
memory_usage_in_mb: float = psutil.Process().memory_info().rss / (1024 * 1024) memory_usage_in_mb: float = psutil.Process().memory_info().rss / (1024 * 1024)
# total_rows: str = Currency.format(BlackJackStats.get_total_rows_count()) # total_rows: str = Currency.format(BlackJackStats.get_total_rows_count())
@ -46,5 +47,5 @@ class Info(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Info(bot)) await bot.add_cog(Info(bot))

View file

@ -2,6 +2,7 @@ import discord
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
from ui.views.introduction import ( from ui.views.introduction import (
@ -11,18 +12,18 @@ from ui.views.introduction import (
class Introduction(commands.Cog): class Introduction(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.introduction.usage = lib.format.generate_usage(self.introduction) self.introduction.usage = lib.format.generate_usage(self.introduction)
@commands.hybrid_command(name="introduction", aliases=["intro"]) @commands.hybrid_command(name="introduction", aliases=["intro"])
async def introduction(self, ctx: commands.Context[commands.Bot]) -> None: async def introduction(self, ctx: commands.Context[Luminara]) -> None:
""" """
Introduction command. Introduction command.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
guild: discord.Guild | None = self.bot.get_guild( guild: discord.Guild | None = self.bot.get_guild(
@ -188,5 +189,5 @@ class Introduction(commands.Cog):
) )
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Introduction(bot)) await bot.add_cog(Introduction(bot))

View file

@ -1,24 +1,25 @@
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
from ui.views.invite import InviteButton from ui.views.invite import InviteButton
class Invite(commands.Cog): class Invite(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.invite.usage = lib.format.generate_usage(self.invite) self.invite.usage = lib.format.generate_usage(self.invite)
@commands.hybrid_command(name="invite", aliases=["inv"]) @commands.hybrid_command(name="invite", aliases=["inv"])
async def invite(self, ctx: commands.Context[commands.Bot]) -> None: async def invite(self, ctx: commands.Context[Luminara]) -> None:
""" """
Invite command. Invite command.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
await ctx.send( await ctx.send(
@ -32,5 +33,5 @@ class Invite(commands.Cog):
) )
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Invite(bot)) await bot.add_cog(Invite(bot))

View file

@ -1,23 +1,24 @@
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
class Ping(commands.Cog): class Ping(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.ping.usage = lib.format.generate_usage(self.ping) self.ping.usage = lib.format.generate_usage(self.ping)
@commands.hybrid_command(name="ping") @commands.hybrid_command(name="ping")
async def ping(self, ctx: commands.Context[commands.Bot]) -> None: async def ping(self, ctx: commands.Context[Luminara]) -> None:
""" """
Show Luminara's latency. Show Luminara's latency.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
embed = Builder.create_embed( embed = Builder.create_embed(
@ -33,5 +34,5 @@ class Ping(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Ping(bot)) await bot.add_cog(Ping(bot))

View file

@ -5,24 +5,25 @@ from discord import Embed
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
class Uptime(commands.Cog): class Uptime(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: Luminara) -> None:
self.bot: commands.Bot = bot self.bot: Luminara = bot
self.start_time: datetime = discord.utils.utcnow() self.start_time: datetime = discord.utils.utcnow()
self.uptime.usage = lib.format.generate_usage(self.uptime) self.uptime.usage = lib.format.generate_usage(self.uptime)
@commands.hybrid_command(name="uptime") @commands.hybrid_command(name="uptime")
async def uptime(self, ctx: commands.Context[commands.Bot]) -> None: async def uptime(self, ctx: commands.Context[Luminara]) -> None:
""" """
Uptime command. Uptime command.
Parameters Parameters
---------- ----------
ctx : commands.Context[commands.Bot] ctx : commands.Context[Luminara]
The context of the command. The context of the command.
""" """
unix_timestamp: int = int(self.start_time.timestamp()) unix_timestamp: int = int(self.start_time.timestamp())
@ -39,5 +40,5 @@ class Uptime(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Uptime(bot)) await bot.add_cog(Uptime(bot))

View file

@ -2,6 +2,7 @@ import discord
from discord import app_commands from discord import app_commands
from discord.ext import commands from discord.ext import commands
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
from wrappers.xkcd import Client, HttpError from wrappers.xkcd import Client, HttpError
@ -47,7 +48,7 @@ async def print_comic(
class Xkcd(commands.Cog): class Xkcd(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
xkcd = app_commands.Group(name="xkcd", description="Get the latest xkcd comic") xkcd = app_commands.Group(name="xkcd", description="Get the latest xkcd comic")
@ -91,5 +92,5 @@ class Xkcd(commands.Cog):
await print_comic(interaction, number=comic_id) await print_comic(interaction, number=comic_id)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Xkcd(bot)) await bot.add_cog(Xkcd(bot))

View file

@ -8,12 +8,13 @@ from discord.ext import commands
import lib.format import lib.format
from lib.actionable import async_actionable from lib.actionable import async_actionable
from lib.case_handler import create_case from lib.case_handler import create_case
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
class Ban(commands.Cog): class Ban(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.ban.usage = lib.format.generate_usage(self.ban) self.ban.usage = lib.format.generate_usage(self.ban)
self.unban.usage = lib.format.generate_usage(self.unban) self.unban.usage = lib.format.generate_usage(self.unban)
@ -24,7 +25,7 @@ class Ban(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def ban( async def ban(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.Member | discord.User, target: discord.Member | discord.User,
*, *,
reason: str | None = None, reason: str | None = None,
@ -93,7 +94,7 @@ class Ban(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def unban( async def unban(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.User, target: discord.User,
*, *,
reason: str | None = None, reason: str | None = None,
@ -145,5 +146,5 @@ class Ban(commands.Cog):
) )
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Ban(bot)) await bot.add_cog(Ban(bot))

View file

@ -6,6 +6,7 @@ from reactionmenu import ViewButton, ViewMenu
import lib.format import lib.format
from lib.case_handler import edit_case_modlog from lib.case_handler import edit_case_modlog
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from lib.format import format_case_number from lib.format import format_case_number
@ -19,7 +20,7 @@ from ui.embeds import Builder
case_service = CaseService() case_service = CaseService()
def create_no_cases_embed(ctx: commands.Context[commands.Bot], author_text: str, description: str) -> discord.Embed: def create_no_cases_embed(ctx: commands.Context[Luminara], author_text: str, description: str) -> discord.Embed:
return Builder.create_embed( return Builder.create_embed(
theme="info", theme="info",
user_name=ctx.author.name, user_name=ctx.author.name,
@ -28,7 +29,7 @@ def create_no_cases_embed(ctx: commands.Context[commands.Bot], author_text: str,
) )
def create_case_view_menu(ctx: commands.Context[commands.Bot]) -> ViewMenu: def create_case_view_menu(ctx: commands.Context[Luminara]) -> ViewMenu:
menu = ViewMenu(ctx, menu_type=ViewMenu.TypeEmbed, all_can_click=True, delete_on_timeout=True) menu = ViewMenu(ctx, menu_type=ViewMenu.TypeEmbed, all_can_click=True, delete_on_timeout=True)
buttons = [ buttons = [
@ -45,7 +46,7 @@ def create_case_view_menu(ctx: commands.Context[commands.Bot]) -> ViewMenu:
class Cases(commands.Cog): class Cases(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.view_case_by_number.usage = lib.format.generate_usage(self.view_case_by_number) self.view_case_by_number.usage = lib.format.generate_usage(self.view_case_by_number)
self.view_all_cases_in_guild.usage = lib.format.generate_usage(self.view_all_cases_in_guild) self.view_all_cases_in_guild.usage = lib.format.generate_usage(self.view_all_cases_in_guild)
@ -57,7 +58,7 @@ class Cases(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def view_case_by_number( async def view_case_by_number(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
case_number: int | None = None, case_number: int | None = None,
) -> None: ) -> None:
""" """
@ -101,14 +102,14 @@ class Cases(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def view_all_cases_in_guild( async def view_all_cases_in_guild(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
) -> None: ) -> None:
""" """
View all cases in the guild. View all cases in the guild.
Parameters Parameters
---------- ----------
ctx: commands.Context[commands.Bot] ctx: commands.Context[Luminara]
The context of the command. The context of the command.
""" """
if not ctx.guild: if not ctx.guild:
@ -144,7 +145,7 @@ class Cases(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def view_all_cases_by_mod( async def view_all_cases_by_mod(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
moderator: discord.Member, moderator: discord.Member,
) -> None: ) -> None:
""" """
@ -188,7 +189,7 @@ class Cases(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def edit_case_reason( async def edit_case_reason(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
case_number: int, case_number: int,
*, *,
new_reason: str, new_reason: str,
@ -232,5 +233,5 @@ class Cases(commands.Cog):
await update_tasks() await update_tasks()
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Cases(bot)) await bot.add_cog(Cases(bot))

View file

@ -7,12 +7,13 @@ from discord.ext import commands
import lib.format import lib.format
from lib.actionable import async_actionable from lib.actionable import async_actionable
from lib.case_handler import create_case from lib.case_handler import create_case
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
class Kick(commands.Cog): class Kick(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.kick.usage = lib.format.generate_usage(self.kick) self.kick.usage = lib.format.generate_usage(self.kick)
@ -22,7 +23,7 @@ class Kick(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def kick( async def kick(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.Member, target: discord.Member,
*, *,
reason: str | None = None, reason: str | None = None,
@ -86,5 +87,5 @@ class Kick(commands.Cog):
await asyncio.gather(respond_task, create_case_task, return_exceptions=True) await asyncio.gather(respond_task, create_case_task, return_exceptions=True)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Kick(bot)) await bot.add_cog(Kick(bot))

View file

@ -5,19 +5,20 @@ from discord import app_commands
from discord.ext import commands from discord.ext import commands
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from lib.format import format_duration_to_seconds from lib.format import format_duration_to_seconds
class Slowmode(commands.Cog): class Slowmode(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.slowmode.usage = lib.format.generate_usage(self.slowmode) self.slowmode.usage = lib.format.generate_usage(self.slowmode)
async def _set_slowmode( async def _set_slowmode(
self, self,
ctx: commands.Context[commands.Bot] | discord.Interaction, ctx: commands.Context[Luminara] | discord.Interaction,
channel: discord.TextChannel, channel: discord.TextChannel,
duration: str | None, duration: str | None,
) -> None: ) -> None:
@ -46,7 +47,7 @@ class Slowmode(commands.Cog):
async def _send_response( async def _send_response(
self, self,
ctx: commands.Context[commands.Bot] | discord.Interaction, ctx: commands.Context[Luminara] | discord.Interaction,
content: str, content: str,
ephemeral: bool = False, ephemeral: bool = False,
) -> None: ) -> None:
@ -64,7 +65,7 @@ class Slowmode(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def slowmode( async def slowmode(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
arg1: str | None = None, arg1: str | None = None,
arg2: str | None = None, arg2: str | None = None,
) -> None: ) -> None:
@ -119,5 +120,5 @@ class Slowmode(commands.Cog):
await self._set_slowmode(interaction, channel, duration) await self._set_slowmode(interaction, channel, duration)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Slowmode(bot)) await bot.add_cog(Slowmode(bot))

View file

@ -7,12 +7,13 @@ from discord.ext import commands
import lib.format import lib.format
from lib.actionable import async_actionable from lib.actionable import async_actionable
from lib.case_handler import create_case from lib.case_handler import create_case
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from ui.embeds import Builder from ui.embeds import Builder
class Softban(commands.Cog): class Softban(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.softban.usage = lib.format.generate_usage(self.softban) self.softban.usage = lib.format.generate_usage(self.softban)
@ -22,7 +23,7 @@ class Softban(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def softban( async def softban(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.Member, target: discord.Member,
*, *,
reason: str | None = None, reason: str | None = None,
@ -94,5 +95,5 @@ class Softban(commands.Cog):
await asyncio.gather(respond_task, create_case_task, return_exceptions=True) await asyncio.gather(respond_task, create_case_task, return_exceptions=True)
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Softban(bot)) await bot.add_cog(Softban(bot))

View file

@ -8,13 +8,14 @@ from discord.ext import commands
import lib.format import lib.format
from lib.actionable import async_actionable from lib.actionable import async_actionable
from lib.case_handler import create_case from lib.case_handler import create_case
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from ui.embeds import Builder from ui.embeds import Builder
class Timeout(commands.Cog): class Timeout(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.timeout.usage = lib.format.generate_usage(self.timeout) self.timeout.usage = lib.format.generate_usage(self.timeout)
self.untimeout.usage = lib.format.generate_usage(self.untimeout) self.untimeout.usage = lib.format.generate_usage(self.untimeout)
@ -25,7 +26,7 @@ class Timeout(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def timeout( async def timeout(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.Member, target: discord.Member,
duration: str, duration: str,
reason: str | None = None, reason: str | None = None,
@ -106,7 +107,7 @@ class Timeout(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def untimeout( async def untimeout(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.Member, target: discord.Member,
reason: str | None = None, reason: str | None = None,
) -> None: ) -> None:
@ -159,5 +160,5 @@ class Timeout(commands.Cog):
) )
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Timeout(bot)) await bot.add_cog(Timeout(bot))

View file

@ -7,13 +7,14 @@ from discord.ext import commands
import lib.format import lib.format
from lib.actionable import async_actionable from lib.actionable import async_actionable
from lib.case_handler import create_case from lib.case_handler import create_case
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from ui.embeds import Builder from ui.embeds import Builder
class Warn(commands.Cog): class Warn(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
self.warn.usage = lib.format.generate_usage(self.warn) self.warn.usage = lib.format.generate_usage(self.warn)
@ -22,7 +23,7 @@ class Warn(commands.Cog):
@commands.guild_only() @commands.guild_only()
async def warn( async def warn(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.Member, target: discord.Member,
*, *,
reason: str | None = None, reason: str | None = None,
@ -78,5 +79,5 @@ class Warn(commands.Cog):
) )
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Warn(bot)) await bot.add_cog(Warn(bot))

View file

@ -6,6 +6,7 @@ from discord.ext import commands
from reactionmenu import ViewButton, ViewMenu from reactionmenu import ViewButton, ViewMenu
import lib.format import lib.format
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.exceptions import LumiException from lib.exceptions import LumiException
from services.reactions_service import CustomReactionsService from services.reactions_service import CustomReactionsService
@ -15,7 +16,7 @@ from ui.embeds import Builder
@app_commands.guild_only() @app_commands.guild_only()
@app_commands.default_permissions(manage_guild=True) @app_commands.default_permissions(manage_guild=True)
class Triggers(commands.GroupCog, group_name="trigger"): class Triggers(commands.GroupCog, group_name="trigger"):
def __init__(self, bot: commands.Bot): def __init__(self, bot: Luminara):
self.bot = bot self.bot = bot
add = app_commands.Group( add = app_commands.Group(
@ -282,5 +283,5 @@ class Triggers(commands.GroupCog, group_name="trigger"):
await menu.start() await menu.start()
async def setup(bot: commands.Bot) -> None: async def setup(bot: Luminara) -> None:
await bot.add_cog(Triggers(bot)) await bot.add_cog(Triggers(bot))

View file

@ -88,7 +88,7 @@ info:
title: Luminara title: Luminara
author: wlinator author: wlinator
license: GNU General Public License v3.0 license: GNU General Public License v3.0
version: "3.0.0-alpha" version: "3.0.1"
repository_url: https://git.wlinator.org/Luminara/Lumi repository_url: https://git.wlinator.org/Luminara/Lumi
invite_url: https://discord.com/oauth2/authorize?client_id=1038050427272429588&permissions=8&scope=bot invite_url: https://discord.com/oauth2/authorize?client_id=1038050427272429588&permissions=8&scope=bot

View file

@ -4,13 +4,14 @@ from typing import Any
import discord import discord
from discord.ext import commands from discord.ext import commands
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from lib.format import format_case_number, format_seconds_to_duration_string from lib.format import format_case_number, format_seconds_to_duration_string
from ui.embeds import Builder from ui.embeds import Builder
def create_case_embed( def create_case_embed(
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
target: discord.User, target: discord.User,
case_number: int, case_number: int,
action_type: str, action_type: str,
@ -76,7 +77,7 @@ def create_case_embed(
def create_case_list_embed( def create_case_list_embed(
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
cases: list[dict[str, Any]], cases: list[dict[str, Any]],
author_text: str, author_text: str,
) -> discord.Embed: ) -> discord.Embed:

View file

@ -2,13 +2,14 @@ import discord
from discord.ext import commands from discord.ext import commands
from discord.ui import Button, View from discord.ui import Button, View
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
class BlackJackButtons(View): class BlackJackButtons(View):
def __init__(self, ctx: commands.Context[commands.Bot]) -> None: def __init__(self, ctx: commands.Context[Luminara]) -> None:
super().__init__(timeout=180) super().__init__(timeout=180)
self.ctx: commands.Context[commands.Bot] = ctx self.ctx: commands.Context[Luminara] = ctx
self.clickedHit: bool = False self.clickedHit: bool = False
self.clickedStand: bool = False self.clickedStand: bool = False
self.clickedDoubleDown: bool = False self.clickedDoubleDown: bool = False

View file

@ -2,11 +2,13 @@ import discord
from discord.ext import commands from discord.ext import commands
from discord.ui import Button, View from discord.ui import Button, View
from lib.client import Luminara
class IntroductionStartButtons(View): class IntroductionStartButtons(View):
def __init__(self, ctx: commands.Context[commands.Bot]) -> None: def __init__(self, ctx: commands.Context[Luminara]) -> None:
super().__init__(timeout=60) super().__init__(timeout=60)
self.ctx: commands.Context[commands.Bot] = ctx self.ctx: commands.Context[Luminara] = ctx
self.clicked_start: bool = False self.clicked_start: bool = False
self.clicked_stop: bool = False self.clicked_stop: bool = False
self.message: discord.Message | None = None self.message: discord.Message | None = None
@ -40,9 +42,9 @@ class IntroductionStartButtons(View):
class IntroductionFinishButtons(View): class IntroductionFinishButtons(View):
def __init__(self, ctx: commands.Context[commands.Bot]) -> None: def __init__(self, ctx: commands.Context[Luminara]) -> None:
super().__init__(timeout=60) super().__init__(timeout=60)
self.ctx: commands.Context[commands.Bot] = ctx self.ctx: commands.Context[Luminara] = ctx
self.clicked_confirm: bool = False self.clicked_confirm: bool = False
self.message: discord.Message | None = None self.message: discord.Message | None = None

View file

@ -4,6 +4,7 @@ from datetime import datetime
import discord import discord
from discord.ext import commands from discord.ext import commands
from lib.client import Luminara
from lib.const import CONST from lib.const import CONST
from services.currency_service import Currency from services.currency_service import Currency
from services.daily_service import Dailies from services.daily_service import Dailies
@ -58,12 +59,12 @@ class LeaderboardCommandView(discord.ui.View):
what kind of leaderboard to show. what kind of leaderboard to show.
""" """
ctx: commands.Context[commands.Bot] ctx: commands.Context[Luminara]
options: LeaderboardCommandOptions options: LeaderboardCommandOptions
def __init__( def __init__(
self, self,
ctx: commands.Context[commands.Bot], ctx: commands.Context[Luminara],
options: LeaderboardCommandOptions, options: LeaderboardCommandOptions,
) -> None: ) -> None:
super().__init__(timeout=180) super().__init__(timeout=180)