Compare commits
No commits in common. "54ac77ceb938dd0ba24073a55df08eb5e53ffc72" and "08512d0dadf3cda1e00900d3470509cd76f5fc20" have entirely different histories.
54ac77ceb9
...
08512d0dad
2 changed files with 19 additions and 20 deletions
|
@ -7,6 +7,7 @@ from typing import Dict, Iterable, List, Optional, Tuple, Union
|
||||||
import discord
|
import discord
|
||||||
from aiosqlite import Connection, Cursor, OperationalError, Row
|
from aiosqlite import Connection, Cursor, OperationalError, Row
|
||||||
from aiosqlite import connect as aiosqlite_connect
|
from aiosqlite import connect as aiosqlite_connect
|
||||||
|
from discord import NotFound
|
||||||
from redbot.core import data_manager
|
from redbot.core import data_manager
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
|
||||||
|
@ -81,28 +82,26 @@ class Moderation(AuroraGuildModel):
|
||||||
self.resolved_by = resolved_by
|
self.resolved_by = resolved_by
|
||||||
self.resolve_reason = reason
|
self.resolve_reason = reason
|
||||||
|
|
||||||
await self.type.resolve_handler(self.bot, self.guild, await self.get_target(), reason)
|
if self.type in ["UNMUTE", "UNBAN"]:
|
||||||
|
raise TypeError("Cannot resolve an unmute or unban case!")
|
||||||
|
|
||||||
# if self.type in ["UNMUTE", "UNBAN"]:
|
if self.type == "MUTE":
|
||||||
# raise TypeError("Cannot resolve an unmute or unban case!")
|
try:
|
||||||
|
guild: discord.Guild = await self.bot.fetch_guild(self.guild_id)
|
||||||
|
member = await guild.fetch_member(self.target_id)
|
||||||
|
|
||||||
# if self.type == "MUTE":
|
await member.timeout(
|
||||||
# try:
|
None, reason=f"Case {self.moderation_id} resolved by {resolved_by}{' for '+ reason if reason else ''}"
|
||||||
# guild: discord.Guild = await self.bot.fetch_guild(self.guild_id)
|
)
|
||||||
# member = await guild.fetch_member(self.target_id)
|
except NotFound:
|
||||||
|
pass
|
||||||
|
|
||||||
# await member.timeout(
|
if self.type in ["BAN", "TEMPBAN"]:
|
||||||
# None, reason=f"Case {self.moderation_id} resolved by {resolved_by}{' for '+ reason if reason else ''}"
|
try:
|
||||||
# )
|
guild: discord.Guild = await self.bot.fetch_guild(self.guild_id)
|
||||||
# except NotFound:
|
await guild.unban(await self.get_target(), reason=f"Case {self.moderation_id} resolved by {resolved_by}{' for '+ reason if reason else ''}")
|
||||||
# pass
|
except NotFound:
|
||||||
|
pass
|
||||||
# if self.type in ["BAN", "TEMPBAN"]:
|
|
||||||
# try:
|
|
||||||
# guild: discord.Guild = await self.bot.fetch_guild(self.guild_id)
|
|
||||||
# await guild.unban(await self.get_target(), reason=f"Case {self.moderation_id} resolved by {resolved_by}{' for '+ reason if reason else ''}")
|
|
||||||
# except NotFound:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
if not self.changes:
|
if not self.changes:
|
||||||
self.changes.append(Change.from_dict(self.bot, {
|
self.changes.append(Change.from_dict(self.bot, {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Type(object):
|
||||||
embed_desc = "been"
|
embed_desc = "been"
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return self.moderation_type
|
return self.type
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, **kwargs) -> 'Type': # pylint: disable=unused-argument
|
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, **kwargs) -> 'Type': # pylint: disable=unused-argument
|
||||||
|
|
Loading…
Reference in a new issue