boticordpy/docs/reference.rst

112 lines
2.1 KiB
ReStructuredText
Raw Normal View History

2021-09-12 12:50:38 +03:00
.. currentmodule:: boticordpy
2021-09-12 13:18:22 +03:00
.. reference:
2021-09-12 12:50:38 +03:00
Event Reference
---------------
Example of event creation:
::
from discord.ext import commands
from boticordpy import BoticordWebhook, BoticordClient
bot = commands.Bot(command_prefix="!")
boticord = BoticordClient(bot, "boticord-api-token")
boticord_webhook = BoticordWebhook(bot, boticord).bot_webhook("/bot", "X-Hook-Key")
boticord_webhook.run(5000)
@boticord.event("edit_bot_comment")
async def on_boticord_comment_edit(data):
print(data)
You can name the function whatever you want, but the decorator must always specify an existing event as an argument.
.. warning::
All the events must be a **coroutine**. If they aren't, then you might get unexpected
errors. In order to turn a function into a coroutine they must be ``async def``
functions.
2021-09-12 13:32:06 +03:00
**new_bot_bump**
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
Called when the user bumps the bot.
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
Return Example:
::
2021-09-12 13:38:45 +03:00
{
'type': 'new_bot_bump',
2021-09-12 13:32:06 +03:00
'data': {
'user': '809377165534822410',
'at': 1631436624444
}
}
**new_bot_comment**
Called when the user creates new comment.
Return Example:
::
2021-09-12 12:50:38 +03:00
2021-09-12 13:38:45 +03:00
{
'type': 'new_bot_comment',
2021-09-12 13:32:06 +03:00
'data': {
'user': '704373738086465607',
'comment': {
'old': None,
'new': 'boticord po jizni top'
},
'at': 1631439995678
}
}
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
**edit_bot_comment**
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
Called when the user edits his comment.
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
Return Example:
::
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
{
'type': 'edit_bot_comment',
'data': {
'user': '585766846268047370',
'comment': {
'old': 'Boticord eto horosho',
'new': 'Boticord horoshiy monitoring'
},
'at': 1631438224813
}
}
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
**delete_bot_comment**
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
Called when the user deletes his comment.
Return Example:
::
2021-09-12 12:50:38 +03:00
2021-09-12 13:32:06 +03:00
{
'type': 'delete_bot_comment',
'data': {
'user': '704373738086465607',
'comment': 'допустим что я картофель',
'vote': 1,
'reason': 'self',
'at': 1631439759384
}
}