Skip to content

Commit

Permalink
Merge branch 'patch-01' of git://github.com/Jerrie-Aries/modmail into…
Browse files Browse the repository at this point in the history
… Jerrie-Aries-patch-01
  • Loading branch information
fourjr committed Aug 6, 2021
2 parents f99245f + 9bb615b commit 7f6c589
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 5 additions & 2 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ async def runner():
if self._session:
await self._session.close()

# noinspection PyUnusedLocal
def stop_loop_on_completion(f):
loop.stop()

Expand Down Expand Up @@ -797,7 +798,7 @@ async def is_blocked(
*,
channel: discord.TextChannel = None,
send_message: bool = False,
) -> typing.Tuple[bool, str]:
) -> bool:

member = self.guild.get_member(author.id)
if member is None:
Expand Down Expand Up @@ -876,7 +877,9 @@ async def get_thread_cooldown(self, author: discord.Member):
return

@staticmethod
async def add_reaction(msg, reaction: discord.Reaction) -> bool:
async def add_reaction(
msg, reaction: typing.Union[discord.Emoji, discord.Reaction, discord.PartialEmoji, str]
) -> bool:
if reaction != "disable":
try:
await msg.add_reaction(reaction)
Expand Down
12 changes: 9 additions & 3 deletions core/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class GitHub:
def __init__(self, bot, access_token: str = "", username: str = "", **kwargs):
self.bot = bot
self.session = bot.session
self.headers: dict = None
self.headers: Optional[dict] = None
self.access_token = access_token
self.username = username
self.avatar_url: str = kwargs.pop("avatar_url", "")
Expand Down Expand Up @@ -317,7 +317,7 @@ async def get_config(self) -> dict:
async def update_config(self, data: dict):
return NotImplemented

async def edit_message(self, message_id: Union[int, str], new_content: str) -> None:
async def edit_message(self, message_id: Union[int, str], new_content: str):
return NotImplemented

async def append_log(
Expand Down Expand Up @@ -357,6 +357,12 @@ async def edit_note(self, message_id: Union[int, str], message: str):
def get_plugin_partition(self, cog):
return NotImplemented

async def update_repository(self) -> dict:
return NotImplemented

async def get_user_info(self) -> Optional[dict]:
return NotImplemented


class MongoDBClient(ApiClient):
def __init__(self, bot):
Expand Down Expand Up @@ -665,7 +671,7 @@ async def update_repository(self) -> dict:
},
}

async def get_user_info(self) -> dict:
async def get_user_info(self) -> Optional[dict]:
try:
user = await GitHub.login(self.bot)
except InvalidConfigError:
Expand Down

0 comments on commit 7f6c589

Please sign in to comment.