This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from enum import Enum | |
import datetime | |
import inspect | |
from collections import defaultdict | |
import discord | |
import discord, discord.channel, discord.http, discord.state | |
from discord.ext import commands |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from discord.ext import commands, tasks | |
class MetaTask(commands.CogMeta): | |
""" | |
A simple Metclass that can be used to get all tasks.Loop from the class, | |
and cancel them easily. | |
""" | |
def __new__(cls, name, bases, attrs, **kwargs): | |
new_cls = super().__new__(cls, name, bases, attrs) | |
_inner_tasks = [] # We'll attach any tasks we find to this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
from discord import app_commands | |
# My custom bot subclass: | |
class MyBot(commands.Bot): | |
... | |
# Create a subclass of our paginator. It accepts two generic arguments, the type of entries | |
# passed to the format_page function and the bot subclass. The bot generic argument is optional. |