discordSuperUtils Modules¶
discordSuperUtils.Antispam module¶
- class discordSuperUtils.Antispam.DefaultSpamDetectionGenerator[source]¶
Bases:
discordSuperUtils.Antispam.SpamDetectionGenerator- generate(last_messages: List[discord.message.Message]) Union[bool, Any][source]¶
This function is an abstract method. The generate function of the generator.
- Parameters
last_messages (List[discord.Message]) – The last messages sent (5 is max).
- Returns
A boolean representing if the message is spam.
- Return type
Union[bool, Any]
- class discordSuperUtils.Antispam.SpamDetectionGenerator[source]¶
Bases:
abc.ABCRepresents a SpamManager that filters messages to find spam.
- abstract generate(last_messages: List[discord.message.Message]) Union[bool, Any][source]¶
This function is an abstract method. The generate function of the generator.
- Parameters
last_messages (List[discord.Message]) – The last messages sent (5 is max).
- Returns
A boolean representing if the message is spam.
- Return type
Union[bool, Any]
- class discordSuperUtils.Antispam.SpamManager(bot: commands.Bot, generator: SpamDetectionGenerator = None, wipe_cache_delay: timedelta = datetime.timedelta(seconds=300))[source]¶
Bases:
discordSuperUtils.Base.EventManagerRepresents a SpamManager which detects spam.
- bot¶
- generator¶
- static get_messages_similarity(messages: Iterable[str]) float[source]¶
Gets the similarity between messages.
- Parameters
messages (Iterable[str]) – Messages to compare.
- Return type
float
- Returns
The similarity between messages (0-1)
- punishments¶
discordSuperUtils.Ban module¶
- class discordSuperUtils.Ban.BanManager(bot: commands.Bot)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker,discordSuperUtils.Punishments.PunisherA BanManager that manages guild bans.
- async ban(member: discord.member.Member, reason: str = 'No reason provided.', time_of_ban: Union[int, float] = 0) None[source]¶
This function is a coroutine.
Bans the member from the guild.
- Parameters
member (discord.Member) – The member to ban.
reason (str) – The reason of the ban.
time_of_ban (Union[int, float]) – The time of ban.
- Returns
None
- Return type
None
- bot¶
- async static get_ban(member: Union[discord.member.Member, discord.user.User], guild: discord.guild.Guild) Optional[discord.user.User][source]¶
This function is a coroutine.
This function returns the user object of the member if he is banned from the guild.
- Parameters
member (discord.Member) – The banned member.
guild (discord.Guild) – The guild.
- Returns
The user object if found.
- Return type
Optional[discord.User]
- async get_banned_members() List[Dict[str, Any]][source]¶
This function is a coroutine.
This function returns all the members that are supposed to be unbanned but are banned.
- Returns
The list of unbanned members.
- Return type
List[Dict[str, Any]]
- async punish(ctx: commands.Context, member: discord.Member, punishment: Punishment) None[source]¶
The manager’s punish function.
- Parameters
ctx (commands.Context) – The context of the punishments.
member (discord.Member) – The member to punish.
punishment (Punishment) – The punishment to punish the member with.
- Return type
None
- Returns
None
discordSuperUtils.Base module¶
- class discordSuperUtils.Base.CogManager[source]¶
Bases:
objectA CogManager which helps the user use the managers inside discord cogs.
- class discordSuperUtils.Base.DatabaseChecker(tables_column_data: List[Dict[str, str]], table_identifiers: List[str])[source]¶
Bases:
discordSuperUtils.Base.EventManagerA database checker which makes sure the database is connected to a manager and handles the table creation.
- async connect_to_database(database: Database, tables: List[str]) None[source]¶
Connects to the database. Calls on_database_connect when connected.
- Parameters
database (Database) – The database to connect to.
tables (List[str]) – The tables to create (incase they do not exist).
- Return type
None
- Returns
None
- exception discordSuperUtils.Base.DatabaseNotConnected[source]¶
Bases:
ExceptionRaises an error when the user tries to use a method of a manager without a database connected to it.
- class discordSuperUtils.Base.EventManager[source]¶
Bases:
objectAn event manager that manages events for managers.
- add_event(func: Callable, name: Optional[str] = None) None[source]¶
Adds an event to the event dictionary.
- Parameters
func (Callable) – The event callback.
name (str) – The event name.
- Returns
None
- Return type
None
- Raises
TypeError: The listener isn’t async.
- async call_event(name: str, *args, **kwargs) None[source]¶
Calls the event name with the arguments
- Parameters
name (str) – The event name.
args – The arguments.
kwargs – The key arguments.
- Returns
None
- Return type
None
- exception discordSuperUtils.Base.InvalidGenerator(generator)[source]¶
Bases:
ExceptionRaises an exception when the user passes an invalid generator.
- generator¶
- discordSuperUtils.Base.generate_column_types(types: Iterable[str], database_type: Any) Optional[List[str]][source]¶
Generates the column type names that are suitable for the database type.
- Parameters
types (Iterable[str]) – The column types.
database_type (Any) – The database type.
- Returns
The suitable column types for the database types.
- Return type
Optional[List[str]]
- discordSuperUtils.Base.get_generator_response(generator: Any, generator_type: Any, *args, **kwargs) Any[source]¶
Returns the generator response with the arguments.
- Parameters
generator (Any) – The generator to get the response from.
generator_type (Any) – The generator type. (Should be same as the generator type.
args – The arguments of the generator.
kwargs – The key arguments of the generator
- Returns
The generator response.
- Return type
Any
- async discordSuperUtils.Base.maybe_coroutine(function: Callable, *args, **kwargs) Any[source]¶
This function is a coroutine.
Returns the coroutine version of the function.
- Parameters
function (Union[Awaitable, Callable]) – The function to convert.
args – The arguments.
kwargs – The key arguments:
- Returns
The coroutine version of the function.
- Return type
Awaitable
- async discordSuperUtils.Base.questionnaire(ctx: commands.Context, questions: Iterable[Union[str, discord.Embed]], public: bool = False, timeout: Union[float, int] = 30, member: discord.Member = None) Tuple[List[str], bool][source]¶
This function is a coroutine.
Questions the member using a “quiz” and returns the answers. The questionnaire can be used without a specific member and be public. If no member was passed and the questionnaire public argument is true, a ValueError will be raised.
- Raises
ValueError: The questionnaire is private and no member was provided.
- Parameters
ctx (commands.Context) – The context (where the questionnaire will ask the questions).
questions (Iterable[Union[str, discord.Embed]]) – The questions the questionnaire will ask.
public (bool) – A bool indicating if the questionnaire is public.
timeout (Union[float, int]) – The number of seconds until the questionnaire will stop and time out.
member (discord.Member) – The member the questionnaire will get the answers from.
- Returns
The answers and a boolean indicating if the questionnaire timed out.
- Return type
Tuple[List[str], bool]
discordSuperUtils.Birthday module¶
- class discordSuperUtils.Birthday.BirthdayManager(bot: discord.ext.commands.bot.Bot)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker- async create_birthday(member: discord.member.Member, member_birthday: float, timezone: str = 'UTC') None[source]¶
- async get_birthday(member: discord.member.Member) Optional[discordSuperUtils.Birthday.BirthdayMember][source]¶
- async get_members_with_birthday(timezones: List[str]) List[Dict[str, Any]][source]¶
This function receives a list of timezones and returns a list of members that have birthdays in that date and timezone.
- Parameters
timezones –
- Returns
- static get_midnight_timezones() List[str][source]¶
This method returns a list of timezones where the current time is 12 am. :return:
- async get_upcoming(guild: discord.guild.Guild) List[discordSuperUtils.Birthday.BirthdayMember][source]¶
- class discordSuperUtils.Birthday.BirthdayMember(birthday_manager: discordSuperUtils.Birthday.BirthdayManager, member: discord.member.Member)[source]¶
Bases:
object- async delete() discordSuperUtils.Birthday.PartialBirthdayMember[source]¶
discordSuperUtils.CommandHinter module¶
- class discordSuperUtils.CommandHinter.CommandHinter(bot: discord.ext.commands.bot.Bot, generator=None)[source]¶
Bases:
object- bot¶
- property command_names: List[str]¶
- generator¶
- class discordSuperUtils.CommandHinter.DefaultResponseGenerator[source]¶
Bases:
discordSuperUtils.CommandHinter.CommandResponseGenerator
discordSuperUtils.Convertors module¶
- class discordSuperUtils.Convertors.TimeConvertor[source]¶
Bases:
discord.ext.commands.converter.ConverterConverts a given argument to an int that represents time in seconds.
Examples
7d: 604800 (7 days in seconds)
1m: 60 (1 minute in seconds)
heyh: BadArgument (‘hey’ is not an int)
100j: BadArgument (‘j’ is not a valid time multiplier)
- async convert(ctx: discord.ext.commands.context.Context, argument: str) Optional[Union[int, float]][source]¶
This function is a coroutine.
The method to override to do conversion logic.
If an error is found while converting, it is recommended to raise a
CommandErrorderived exception as it will properly propagate to the error handlers.- Parameters
ctx (
Context) – The invocation context that the argument is being used in.argument (
str) – The argument that is being converted.
- Raises
CommandError – A generic exception occurred when converting the argument.
BadArgument – The converter failed to convert the argument.
discordSuperUtils.Database module¶
- class discordSuperUtils.Database.Database(database)[source]¶
Bases:
abc.ABC- abstract async create_table(table_name: str, columns: Optional[Dict[str, str]] = None, exists: Optional[bool] = False)[source]¶
- abstract async execute(sql_query: str, values: List[Any], fetchall: bool = True) Union[List[Dict[str, Any]], Dict[str, Any]][source]¶
- abstract async insertifnotexists(table_name: str, data: Dict[str, Any], checks: Dict[str, Any])[source]¶
discordSuperUtils.Economy module¶
- class discordSuperUtils.Economy.EconomyAccount(guild: int, member: int, database, table)[source]¶
Bases:
object
- class discordSuperUtils.Economy.EconomyManager(bot)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker- async get_account(member: discord.member.Member) Optional[discordSuperUtils.Economy.EconomyAccount][source]¶
- async get_leaderboard(guild) List[discordSuperUtils.Economy.EconomyAccount][source]¶
discordSuperUtils.FiveM module¶
- class discordSuperUtils.FiveM.FiveMPlayer(player_id, identifiers, name, ping)[source]¶
Bases:
object
discordSuperUtils.Imaging module¶
- class discordSuperUtils.Imaging.Backgrounds(value)[source]¶
Bases:
enum.EnumAn enumeration.
- BLANK_GRAY = 'd:\\python\\lib\\site-packages\\discordSuperUtils\\assets\\2.png'¶
- GALAXY = 'd:\\python\\lib\\site-packages\\discordSuperUtils\\assets\\1.png'¶
- GAMING = 'd:\\python\\lib\\site-packages\\discordSuperUtils\\assets\\3.png'¶
- class discordSuperUtils.Imaging.ImageManager[source]¶
Bases:
object- async create_leveling_profile(member: discord.Member, member_account: LevelingAccount, background: Backgrounds, text_color: Tuple[int, int, int], rank: int, font_path: str = None, outline: int = 5) discord.File[source]¶
- async create_welcome_card(member: discord.member.Member, background: discordSuperUtils.Imaging.Backgrounds, text_color: Tuple[int, int, int], title: str, description: str, font_path: Optional[str] = None, outline: int = 5, transparency: int = 0) discord.file.File[source]¶
- async draw_profile_picture(card: Image, member: discord.Member, location: Tuple[int, int], size: int = 180, outline_thickness: int = 5, status: bool = True, outline_color: Tuple[int, int, int] = (255, 255, 255))[source]¶
discordSuperUtils.Infractions module¶
- class discordSuperUtils.Infractions.Infraction(database, table: str, member: discord.Member, infraction_id: str)[source]¶
Bases:
objectAn infraction object.
- async delete() discordSuperUtils.Infractions.PartialInfraction[source]¶
- class discordSuperUtils.Infractions.InfractionManager(bot: commands.Bot)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker,discordSuperUtils.Punishments.Punisher- async get_infractions(member: discord.Member, infraction_id: str = None, from_timestamp: Union[int, float] = 0) List[Infraction][source]¶
- async punish(ctx: commands.Context, member: discord.Member, punishment: Punishment) None[source]¶
The manager’s punish function.
- Parameters
ctx (commands.Context) – The context of the punishments.
member (discord.Member) – The member to punish.
punishment (Punishment) – The punishment to punish the member with.
- Return type
None
- Returns
None
- async warn(ctx: commands.Context, member: discord.Member, reason: str) Infraction[source]¶
discordSuperUtils.InviteTracker module¶
” If InviteTracker is used in any way that breaks Discord TOS we, (the DiscordSuperUtils team) are not responsible or liable in any way. InviteTracker by DiscordSuperUtils was not intended to violate Discord TOS in any way. In case we are contacted by Discord, we will remove any and all features that violate the Discord ToS. Please feel free to read the Discord Terms of Service https://discord.com/terms.
- class discordSuperUtils.InviteTracker.InviteAccount(invite_tracker: InviteTracker, member: discord.Member)[source]¶
Bases:
object
- class discordSuperUtils.InviteTracker.InviteTracker(bot: commands.Bot)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker- get_user_info(member: discord.Member) InviteAccount[source]¶
discordSuperUtils.Kick module¶
- class discordSuperUtils.Kick.KickManager(bot: commands.Bot)[source]¶
Bases:
discordSuperUtils.Base.EventManager,discordSuperUtils.Punishments.PunisherA KickManager that manages kicks for guilds.
- bot¶
- async punish(ctx: commands.Context, member: discord.Member, punishment: Punishment) None[source]¶
The manager’s punish function.
- Parameters
ctx (commands.Context) – The context of the punishments.
member (discord.Member) – The member to punish.
punishment (Punishment) – The punishment to punish the member with.
- Return type
None
- Returns
None
discordSuperUtils.Leveling module¶
- class discordSuperUtils.Leveling.LevelingAccount(leveling_manager: LevelingManager, member: discord.Member)[source]¶
Bases:
object
- class discordSuperUtils.Leveling.LevelingManager(bot, award_role: bool = False, default_role_interval: int = 5, xp_on_message=5, rank_multiplier=1.5, xp_cooldown=60)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker- async get_roles(guild: discord.Guild) List[int][source]¶
Returns the role IDs of the guild.
- Parameters
guild (discord.Guild) – The guild to get the roles from.
- Returns
- Return type
List[int]
discordSuperUtils.MessageFilter module¶
- class discordSuperUtils.MessageFilter.DefaultMessageResponseGenerator[source]¶
Bases:
discordSuperUtils.MessageFilter.MessageResponseGenerator- DISCORD_INVITE_RE = re.compile('(?:(?:http|https)://)?(?:www.)?(?:disco|discord|discordapp).(?:com|gg|io|li|me|net|org)(?:/(?:invite))?/([a-z0-9-.]+)')¶
- URL_RE = re.compile('(https?://(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?://(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0)¶
- generate(message: discord.Message) Union[bool, Any][source]¶
This function is an abstract method. The generate function of the generator.
- Parameters
message (discord.Message) – The message to filter.
- Returns
A boolean representing if the message contains inappropriate content.
- Return type
Union[bool, Any]
- class discordSuperUtils.MessageFilter.MessageFilter(bot: commands.Bot, generator: MessageResponseGenerator = None, delete_message: bool = True, wipe_cache_delay: timedelta = datetime.timedelta(seconds=300))[source]¶
Bases:
discordSuperUtils.Base.EventManagerRepresents a discordSuperUtils message filter that filters messages and finds inappropriate content.
- bot¶
- generator¶
- punishments¶
- wipe_cache_delay¶
- class discordSuperUtils.MessageFilter.MessageResponseGenerator[source]¶
Bases:
abc.ABCRepresents a URL response generator that filters messages and checks if they contain URLs or anything inappropriate.
- abstract generate(message: discord.Message) Union[bool, Any][source]¶
This function is an abstract method. The generate function of the generator.
- Parameters
message (discord.Message) – The message to filter.
- Returns
A boolean representing if the message contains inappropriate content.
- Return type
Union[bool, Any]
discordSuperUtils.Music module¶
- exception discordSuperUtils.Music.AlreadyConnected[source]¶
Bases:
ExceptionRaises error when client is already connected to voice
- exception discordSuperUtils.Music.AlreadyPaused[source]¶
Bases:
ExceptionRaises error when player is already paused.
- exception discordSuperUtils.Music.InvalidSkipIndex[source]¶
Bases:
ExceptionRaises error when the skip index is < 0
- class discordSuperUtils.Music.Loops(value)[source]¶
Bases:
enum.EnumAn enumeration.
- LOOP = 1¶
- NO_LOOP = 0¶
- QUEUE_LOOP = 2¶
- class discordSuperUtils.Music.MusicManager(bot: commands.Bot, spotify_support: bool = True, inactivity_timeout: int = 60, **kwargs)[source]¶
Bases:
discordSuperUtils.Base.EventManagerRepresents a MusicManager.
- bot¶
- client_id¶
- client_secret¶
- async create_player(query: str, requester: discord.member.Member) List[discordSuperUtils.Music.Player][source]¶
This function is a coroutine.
Creates a list of players from the query. This function supports Spotify and all YTDL supported links.
- Parameters
requester (discord.Member) – The requester.
query (str) – The query.
- Returns
The list of players.
- Return type
List[Player]
- async ensure_activity(ctx: commands.Context) None[source]¶
This function is a coroutine.
Waits the inactivity timeout and ensures the voice client in ctx is playing a song. If no song is playing, it disconnects and calls the on_inactivity_timeout event.
- Parameters
ctx (commands.Context) – The context.
- Returns
None
- Return type
None
- async static fetch_data(query: str) Optional[dict][source]¶
This function is a coroutine.
Fetches the YTDL data of the query.
- Parameters
query (str) – The query.
- Returns
The YTDL data.
- Return type
Optional[dict]
- async get_player_played_duration(ctx: commands.Context, player: Player) Optional[float][source]¶
This function is a coroutine.
Returns the played duration of a player.
- Parameters
ctx (commands.Context) – The context.
player (Player) – The player.
- Returns
The played duration of the player in seconds.
- Return type
Optional[float]
- async get_queue(ctx: commands.Context) Optional[QueueManager][source]¶
This function is a coroutine.
Returns the queue of ctx.
- Parameters
ctx (commands.Context) – The context.
- Returns
The queue.
- Return type
Optional[QueueManager]
- inactivity_timeout¶
- async join(ctx: commands.Context) Optional[discord.VoiceChannel][source]¶
This function is a coroutine.
Joins the ctx voice channel. Calls on_music_error with AlreadyConnected or UserNotConnected.
- Parameters
ctx (commands.Context) – The context.
- Returns
The voice channel it joined.
- Return type
Optional[discord.VoiceChannel]
- async leave(ctx: commands.Context) Optional[discord.VoiceChannel][source]¶
This function is a coroutine.
Leaves the voice channel in ctx.
- Parameters
ctx (commands.Context) – The context.
- Returns
The voice channel it left.
- Return type
Optional[discord.VoiceChannel]
- async loop(ctx: commands.Context) Optional[bool][source]¶
This function is a coroutine.
Toggles the loop.
- Parameters
ctx (commands.Context) – The context
- Returns
A bool indicating if the loop is now enabled or disabled.
- Return type
Optional[bool]
- async lyrics(ctx: commands.Context, query: str = None) Optional[str][source]¶
This function is a coroutine.
Returns the lyrics from the query or the currently playing song.
- Parameters
ctx (commands.Context) – The context.
query (str) – The query.
- Returns
The lyrics.
- Return type
Optional[str]
- async now_playing(ctx: commands.Context) Optional[Player][source]¶
This function is a coroutine.
Returns the currently playing player.
- Parameters
ctx (commands.Context) – The context.
- Returns
The currently playing player.
- Return type
Optional[Player]
- async pause(ctx: commands.Context) Optional[bool][source]¶
This function is a coroutine.
Pauses the currently playing song in ctx. Calls on_music_error with AlreadyPaused if already paused.
- Parameters
ctx (commands.Context) – The context.
- Returns
A bool indicating if the pause was successful
- Return type
Optional[bool]
- async play(ctx: commands.Context, player: Player = None) Optional[bool][source]¶
This function is a coroutine.
Plays the player or the next song in the queue if the player is not passed.
- Parameters
ctx (commands.Context) – The context.
player (Player) – The player.
- Returns
A bool indicating if the play was successful
- Return type
Optional[bool]
- queue¶
- async queue_add(players: List[Player], ctx: commands.Context) Optional[bool][source]¶
This function is a coroutine.
Adds a list of players to the ctx queue. If a queue does not exist in ctx, it creates one.
- Parameters
players (List[Player]) – The list of players.
ctx (commands.Context) – The context.
- Returns
A bool indicating if it was successful
- Return type
Optional[bool]
- async queue_remove(ctx: commands.Context, index: int) None[source]¶
This function is a coroutine.
Removes a player from the queue in ctx at the specified index. Calls on_music_error with QueueError if index is invalid.
- Parameters
ctx (commands.Context) – The context.
index (int) – The index.
- Returns
None
- Return type
None
- async queueloop(ctx: commands.Context) Optional[bool][source]¶
This function is a coroutine.
Toggles the queue loop.
- Parameters
ctx (commands.Context) – The context
- Returns
A bool indicating if the queue loop is now enabled or disabled.
- Return type
Optional[bool]
- async resume(ctx: commands.Context) Optional[bool][source]¶
This function is a coroutine.
Resumes the currently paused song in ctx. Calls on_music_error with NotPaused if not paused.
- Parameters
ctx (commands.Context) – The context.
- Returns
A bool indicating if the resume was successful
- Return type
Optional[bool]
- async skip(ctx: commands.Context, index: int = None) Optional[Player][source]¶
This function is a coroutine.
Skips to the index in ctx. Calls on_music_error with InvalidSkipIndex or SkipError.
- Parameters
index (int) – The index to skip to.
ctx (commands.Context) – The context.
- Returns
A bool indicating if the skip was successful
- Return type
Optional[Player]
- spotify¶
- spotify_support¶
- async volume(ctx: commands.Context, volume: int = None) Optional[float][source]¶
This function is a coroutine.
Sets the volume in ctx. Returns the current volume if volume is None.
- Parameters
volume (int) – The volume to set.
ctx (commands.Context) – The context.
- Returns
The new volume.
- Return type
Optional[float]
- exception discordSuperUtils.Music.NotConnected[source]¶
Bases:
ExceptionRaises error when client is not connected to a voice channel
- exception discordSuperUtils.Music.NotPaused[source]¶
Bases:
ExceptionRaises error when player is not paused
- exception discordSuperUtils.Music.NotPlaying[source]¶
Bases:
ExceptionRaises error when client is not playing
- class discordSuperUtils.Music.Player(source, requester: discord.member.Member, *, data, volume=0.1)[source]¶
Bases:
discord.player.PCMVolumeTransformerRepresents a music player.
- data¶
- duration¶
- last_pause_timestamp¶
- async static make_multiple_players(songs: Iterable[str], requester: discord.member.Member) List[discordSuperUtils.Music.Player][source]¶
This function is a coroutine.
Returns a list of players from a iterable of queries.
- Parameters
requester (discord.Member) – The requester.
songs (Iterable[str]) – The queries.
- Returns
The list of created players.
- Return type
List[Player]
- async classmethod make_player(query: str, requester: discord.member.Member, playlist: bool = True) List[discordSuperUtils.Music.Player][source]¶
This function is a coroutine.
Returns a list of players from the query. The list will contain the first video incase it is not a playlist.
- Parameters
requester (discord.Member) – The requester.
query (str) – The query.
playlist (bool) – A bool indicating if the function should fetch playlists or get the first video.
- Returns
The list of created players.
- Return type
List[Player]
- start_timestamp¶
- stream_url¶
- title¶
- url¶
- exception discordSuperUtils.Music.QueueEmpty[source]¶
Bases:
ExceptionRaises error when queue is empty
- exception discordSuperUtils.Music.QueueError[source]¶
Bases:
ExceptionRaises error when something is wrong with the queue
- class discordSuperUtils.Music.QueueManager(volume: float, queue: List[discordSuperUtils.Music.Player])[source]¶
Bases:
object- add(player: discordSuperUtils.Music.Player) None[source]¶
Adds a player to the queue.
- Parameters
player (Player) – The player to add.
- Returns
None
- Return type
None
- history¶
- loop¶
- now_playing¶
- queue¶
- remove(index: int) Union[discordSuperUtils.Music.Player, Any][source]¶
Removes and element from the queue at the specified index, and returns the element’s value.
- Parameters
index (int) – The index.
- Returns
The element’s value
- Return type
Union[Player, Any]
- volume¶
discordSuperUtils.Mute module¶
- exception discordSuperUtils.Mute.AlreadyMuted[source]¶
Bases:
ExceptionRaises an error when a user is already muted.
- class discordSuperUtils.Mute.MuteManager(bot: commands.Bot)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker,discordSuperUtils.Punishments.PunisherA MuteManager that handles mutes for guilds.
- bot¶
- async static ensure_permissions(guild: discord.guild.Guild, muted_role: discord.role.Role) None[source]¶
This function is a coroutine.
This function loops through the guild’s channels and ensures the muted_role is not allowed to send messages or speak in that channel.
- Parameters
guild (discord.Guild) – The guild to get the channels from.
muted_role (discord.Role) – The muted role.
- Returns
None
- async get_muted_members() List[Dict[str, Any]][source]¶
This function is a coroutine.
This function returns all the members that are supposed to be unmuted but are muted.
- Returns
The unmuted members.
- Return type
List[Dict[str, Any]]
- async mute(member: discord.member.Member, reason: str = 'No reason provided.', time_of_mute: Union[int, float] = 0) None[source]¶
This function is a coroutine.
Mutes a member.
- Raises
AlreadyMuted: The member is already muted.
- Parameters
member (discord.Member) – The member to mute.
reason (str) – The reason of the mute.
time_of_mute (Union[int, float]) – The time of mute.
- Returns
None,
- Return type
None
- async on_member_join(member: discord.member.Member) None[source]¶
This function is a coroutine.
The on_member_join event callback. Used so the member cant leave the guild, join back and be unmuted.
- Parameters
member (discord.Member) – The member that joined.
- Returns
None
- Return type
None
- async punish(ctx: commands.Context, member: discord.Member, punishment: Punishment) None[source]¶
The manager’s punish function.
- Parameters
ctx (commands.Context) – The context of the punishments.
member (discord.Member) – The member to punish.
punishment (Punishment) – The punishment to punish the member with.
- Return type
None
- Returns
None
discordSuperUtils.Paginator module¶
- class discordSuperUtils.Paginator.ButtonsPageManager(ctx, messages, timeout=60, buttons=None, public=False, index=0, button_color=None)[source]¶
Bases:
object- button_color¶
- buttons¶
- ctx¶
- index¶
- messages¶
- public¶
- timeout¶
discordSuperUtils.Prefix module¶
discordSuperUtils.Punishments module¶
- class discordSuperUtils.Punishments.Punisher[source]¶
Bases:
abc.ABC- abstract async punish(ctx: commands.Context, member: discord.Member, punishment: Punishment) None[source]¶
The manager’s punish function.
- Parameters
ctx (commands.Context) – The context of the punishments.
member (discord.Member) – The member to punish.
punishment (Punishment) – The punishment to punish the member with.
- Return type
None
- Returns
None
- class discordSuperUtils.Punishments.Punishment(punishment_manager, punish_after: int = 3, punishment_reason: str = 'No reason specified.', punishment_time: datetime.timedelta = datetime.timedelta(days=1))[source]¶
Bases:
objectA punishment class that is used for punishing members.
- discordSuperUtils.Punishments.get_relevant_punishment(punishments: List[discordSuperUtils.Punishments.Punishment], punish_count: int) Optional[discordSuperUtils.Punishments.Punishment][source]¶
Returns the punishment that is suitable for the punish count.
- Parameters
punishments (List[Punishment]) – The punishments to pick from.
punish_count (int) – The punishment count.
- Return type
Optional[Punishment]
- Returns
The suitable punishment.
discordSuperUtils.ReactionRoles module¶
discordSuperUtils.Spotify module¶
- class discordSuperUtils.Spotify.SpotifyClient(client_id: str, client_secret: str, loop=None)[source]¶
Bases:
object- async fetch_full_playlist(url: str) List[Dict[str, dict]][source]¶
This function receives a url and returns all the tracks in that URL.
- Parameters
url –
- Returns
- async fetch_playlist_data(url: str, offset: int) Dict[str, Union[int, list]][source]¶
This function receives a URL and an offset and returns 100 tracks from that offset Example: Offset: 50, the URL has 160 tracks, returns tracks from 50-150 (limit is 100).
- Parameters
url –
offset –
- Returns
- async get_songs(url: str) List[str][source]¶
This function receives a URL and returns all the tracks in that URL.
- Parameters
url –
- Returns
discordSuperUtils.Template module¶
- class discordSuperUtils.Template.DictionaryConvertible[source]¶
Bases:
abc.ABC- abstract classmethod from_dict(convert_from: Dict[str, Any]) discordSuperUtils.Template.DictionaryConvertible[source]¶
- class discordSuperUtils.Template.PartialTemplate(info: discordSuperUtils.Template.TemplateInfo, categories: List[discordSuperUtils.Template.TemplateCategory], text_channels: List[discordSuperUtils.Template.TemplateTextChannel], voice_channels: List[discordSuperUtils.Template.TemplateVoiceChannel], roles: List[discordSuperUtils.Template.TemplateRole])[source]¶
Bases:
object- categories¶
- info¶
- roles¶
- text_channels¶
- voice_channels¶
- class discordSuperUtils.Template.Template(database: Database, tables: Dict[str, str], info: TemplateInfo, categories: List[TemplateCategory], text_channels: List[TemplateTextChannel], voice_channels: List[TemplateVoiceChannel], roles: List[TemplateRole])[source]¶
Bases:
object- async apply_categories(guild: discord.guild.Guild, reason: str) Dict[int, discord.channel.CategoryChannel][source]¶
- async apply_channels(guild: discord.guild.Guild, reason: str, categories: Dict[int, discord.channel.CategoryChannel], roles: Dict[int, discord.role.Role]) Dict[int, discord.channel.TextChannel][source]¶
- async apply_settings(guild: discord.guild.Guild, reason: str, channels: Dict[int, Union[discord.channel.VoiceChannel, discord.channel.TextChannel]]) None[source]¶
- async apply_voice_channels(guild: discord.guild.Guild, reason: str, categories: Dict[int, discord.channel.CategoryChannel], roles: Dict[int, discord.role.Role]) Dict[int, discord.channel.VoiceChannel][source]¶
- categories¶
- database¶
- async delete() discordSuperUtils.Template.PartialTemplate[source]¶
- static format_overwrites(overwrites: Dict[int, discord.permissions.PermissionOverwrite], roles: Dict[int, discord.role.Role]) Dict[discord.role.Role, discord.permissions.PermissionOverwrite][source]¶
- static get_overwrite(overwrites: List[Dict[str, Any]], overwrite_object: int) Dict[int, discord.permissions.PermissionOverwrite][source]¶
- async classmethod get_template(database: Database, tables: Dict[str, str], template_id: str) Optional[Template][source]¶
- info¶
- roles¶
- tables¶
- text_channels¶
- voice_channels¶
- class discordSuperUtils.Template.TemplateCategory(name: str, position: int, category_id: int, overwrites: Dict[int, int])[source]¶
Bases:
discordSuperUtils.Template.DictionaryConvertible- category_id¶
- classmethod from_dict(convert_from: Dict[Any, Any]) discordSuperUtils.Template.TemplateCategory[source]¶
- name¶
- overwrites¶
- position¶
- class discordSuperUtils.Template.TemplateInfo(template_id: str, guild: int, afk_timeout: int, mfa_level: int, verification_level: discord.enums.VerificationLevel, explict_content_filter: int, system_channel: int, afk_channel: int)[source]¶
Bases:
discordSuperUtils.Template.DictionaryConvertible- afk_channel¶
- afk_timeout¶
- explict_content_filter¶
- classmethod from_dict(convert_from: Dict[str, Any]) discordSuperUtils.Template.TemplateInfo[source]¶
- guild¶
- mfa_level¶
- system_channel¶
- template_id¶
- verification_level¶
- class discordSuperUtils.Template.TemplateManager(bot: commands.Bot)[source]¶
Bases:
discordSuperUtils.Base.DatabaseChecker- bot¶
- async create_template(guild: discord.guild.Guild) discordSuperUtils.Template.Template[source]¶
- async get_template(template_id: str) Optional[discordSuperUtils.Template.Template][source]¶
- async get_templates(guild: Optional[discord.guild.Guild] = None) List[discordSuperUtils.Template.Template][source]¶
- class discordSuperUtils.Template.TemplateRole(default_role: bool, name: str, color: int, hoist: bool, position: int, mentionable: bool, role_id: int, permissions: discord.permissions.Permissions)[source]¶
Bases:
discordSuperUtils.Template.DictionaryConvertible- color¶
- default_role¶
- classmethod from_dict(convert_from: Dict[str, Any]) discordSuperUtils.Template.TemplateRole[source]¶
- hoist¶
- mentionable¶
- name¶
- permissions¶
- position¶
- role_id¶
- class discordSuperUtils.Template.TemplateTextChannel(name: str, position: int, category: int, topic: str, slowmode: int, nsfw: bool, channel_id: int, overwrites: Dict[int, discord.permissions.PermissionOverwrite])[source]¶
Bases:
discordSuperUtils.Template.DictionaryConvertible- category¶
- channel_id¶
- classmethod from_dict(convert_from: Dict[str, Any]) discordSuperUtils.Template.TemplateTextChannel[source]¶
- name¶
- nsfw¶
- overwrites¶
- position¶
- slowmode¶
- topic¶
- class discordSuperUtils.Template.TemplateVoiceChannel(name: str, position: int, category: int, bitrate: int, user_limit: int, channel_id: int, overwrites: Dict[int, discord.permissions.PermissionOverwrite])[source]¶
Bases:
discordSuperUtils.Template.DictionaryConvertible- bitrate¶
- category¶
- channel_id¶
- classmethod from_dict(convert_from: Dict[str, Any]) discordSuperUtils.Template.TemplateVoiceChannel[source]¶
- name¶
- overwrites¶
- position¶
- user_limit¶