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

chore: Refactor actionable function to use async/await for better performance

This commit is contained in:
wlinator 2024-08-02 05:53:34 -04:00
parent 4e9a6e450f
commit e7a891866c
3 changed files with 5 additions and 5 deletions

View file

@ -4,7 +4,7 @@ import discord
from lib import formatter
from lib.constants import CONST
from lib.embed_builder import EmbedBuilder
from modules.moderation.utils import actionable
from modules.moderation.utils.actionable import async_actionable
from modules.moderation.utils.case_handler import create_case
from typing import Optional
@ -18,7 +18,7 @@ async def ban_user(cog, ctx, target: discord.User, reason: Optional[str] = None)
# member -> user is in the guild, check role hierarchy
if member:
bot_member = await cog.client.get_or_fetch_member(ctx.guild, ctx.bot.user.id)
await actionable.actionable(member, ctx.author, bot_member)
await async_actionable(member, ctx.author, bot_member)
try:
await member.send(

View file

@ -3,7 +3,7 @@ from lib.exceptions.LumiExceptions import LumiException
from lib.constants import CONST
async def actionable(
async def async_actionable(
target: discord.Member,
invoker: discord.Member,
bot_user: discord.Member,

View file

@ -5,12 +5,12 @@ import asyncio
from lib.embed_builder import EmbedBuilder
from lib.constants import CONST
from modules.moderation.utils.case_handler import create_case
from modules.moderation.utils.actionable import actionable
from modules.moderation.utils.actionable import async_actionable
async def warn_user(ctx, target: discord.Member, reason: Optional[str]):
bot_member = await MemberConverter().convert(ctx, str(ctx.bot.user.id))
await actionable(target, ctx.author, bot_member)
await async_actionable(target, ctx.author, bot_member)
output_reason = reason or CONST.STRINGS["mod_no_reason"]