fix(core): close TUXBOT-BOT-11, close TUXBOT-BOT-19
This commit is contained in:
parent
fa98d67276
commit
7423b40337
2 changed files with 12 additions and 5 deletions
|
@ -107,11 +107,16 @@ class Tux(commands.AutoShardedBot):
|
|||
return True
|
||||
|
||||
if (
|
||||
search_for(self.config.Servers, message.guild.id, "blacklisted")
|
||||
search_for(self.config.Users, message.author.id, "blacklisted")
|
||||
or search_for(
|
||||
self.config.Channels, message.channel.id, "blacklisted"
|
||||
)
|
||||
or search_for(self.config.Users, message.author.id, "blacklisted")
|
||||
or (
|
||||
message.guild
|
||||
and search_for(
|
||||
self.config.Servers, message.guild.id, "blacklisted"
|
||||
)
|
||||
)
|
||||
):
|
||||
return True
|
||||
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
from typing import List
|
||||
from typing import List, Union
|
||||
|
||||
import discord
|
||||
|
||||
from tuxbot.core.config import search_for
|
||||
|
||||
|
||||
def get_prefixes(tux, guild: discord.Guild) -> List[str]:
|
||||
def get_prefixes(tux, guild: Union[discord.Guild, None]) -> List[str]:
|
||||
"""Get custom prefixes for one guild.
|
||||
Parameters
|
||||
----------
|
||||
tux:Tux
|
||||
The bot instance.
|
||||
|
||||
guild:discord.Guild
|
||||
guild:Union[discord.Guild, None]
|
||||
The required guild prefixes.
|
||||
Returns
|
||||
-------
|
||||
List[str]
|
||||
List of all prefixes.
|
||||
"""
|
||||
if not guild:
|
||||
return []
|
||||
return search_for(tux.config.Servers, guild.id, "prefixes", [])
|
||||
|
|
Loading…
Reference in a new issue