2021-02-11 18:40:00 +01:00
|
|
|
from typing import List, Union
|
2020-10-19 00:20:58 +02:00
|
|
|
|
|
|
|
import discord
|
|
|
|
|
2020-10-19 00:53:26 +02:00
|
|
|
from tuxbot.core.config import search_for
|
2020-10-19 00:20:58 +02:00
|
|
|
|
|
|
|
|
2021-02-11 18:40:00 +01:00
|
|
|
def get_prefixes(tux, guild: Union[discord.Guild, None]) -> List[str]:
|
2020-10-19 00:20:58 +02:00
|
|
|
"""Get custom prefixes for one guild.
|
|
|
|
Parameters
|
|
|
|
----------
|
|
|
|
tux:Tux
|
|
|
|
The bot instance.
|
|
|
|
|
2021-02-11 18:40:00 +01:00
|
|
|
guild:Union[discord.Guild, None]
|
2020-10-19 00:20:58 +02:00
|
|
|
The required guild prefixes.
|
|
|
|
Returns
|
|
|
|
-------
|
|
|
|
List[str]
|
|
|
|
List of all prefixes.
|
|
|
|
"""
|
2021-02-11 18:40:00 +01:00
|
|
|
if not guild:
|
|
|
|
return []
|
2020-10-19 00:53:26 +02:00
|
|
|
return search_for(tux.config.Servers, guild.id, "prefixes", [])
|