Skip to content

Latest commit

 

History

History
181 lines (88 loc) · 2.55 KB

glossary.md

File metadata and controls

181 lines (88 loc) · 2.55 KB

Glossary


Cog

Container for Commands. Simplified it is a Discord class. As a class it is able to keep states.

Inside a Cog there can be defined:

  • commands
  • listener
  • background loops

It is implemented in a way, that it gets loaded like a plug-in, therefore can be disabled, reloaded or unloaded easily. Can also be seen as a kind of Category for commands. Each Cog has access to the bot itself and can therefore access bot attributes as well as other Cogs (in a complicated way).


Asyncio

Asynchronous code execution. It is the reason why the bot still responds even though there is a command already running. Some awful implementation which makes code duplication almost mandatory. I may write more about it when I stop hating it like the devilspawn it is.

asyncio function definition:

async def function_name(parameter_name):
    print(parameter_name)
    return parameter_name

asyncio function call:

x = await function_name('I hate asyncio')

stupid asyncio problems:

  • you can call normal functions from asyncio functions, but you cannot call asyncio functions from normal functions
  • you should almost always look for a version of the package you want to use, that is written special for asyncio. (aiohttp vs. requests)
  • if you call a normal function make sure it is not a long calculating one, as everything basically halts while it is executing.
  • If you do have to, use
x = await run_in_executor(normal_function_name, parameter_name)
  • best to most often write the function or method as normal function and I will convert it to the astupido afterwards.

Listener

TODO


Commands

TODO


Background loop

TODO


Checks

TODO


Cooldowns

TODO


Bot Support

TODO


Context

TODO


Embeds

TODO


Presence

TODO


Intents

TODO