Skip to content

Instantly share code, notes, and snippets.

init python:
class HoverTooltips:
hovers = {
"camping": {
"activated": False,
"tooltip": "Tooltip for this scene",
},
"tournament": {
"activated": False,
import signal
def timeout(func, duration, *args, **kwargs):
"""
Handles timing out a function
Parameters
----------
func
def deprecated(msg="", replace=None):
"""A decorator that denotes that an object wrapped with this is deprecated. This can be around classes,
methods, properties (only put it around the getter, not the setter), staticmethods, and classmethods.
Parameters
-----------
msg : :class:`str`
An extra message that will be put a line after the default one printed with the deprecation warning
replace : :class:`object`
@Phxntxm
Phxntxm / overload.py
Last active April 15, 2020 06:20
Overloaded methods
import traceback
import inspect
from copy import copy
overloaded_functions = {}
def overload(func):
# Create a mapping of overloaded functions, based on the name of the function
@Phxntxm
Phxntxm / custom_commands.py
Last active April 21, 2024 22:42
A pretty simplified way to implement custom commands into your bot.
from discord.ext import commands
# The check to ensure this is the guild used where the command was made
def guild_check(_custom_commands):
async def predicate(ctx):
return _custom_commands.get(ctx.command.qualified_name) and ctx.guild.id in _custom_commands.get(ctx.command.qualified_name)
return commands.check(predicate)
class CustomCommands(commands.Cog):