Пример #1
0
async def on_server_update(post, pre):
    event = Map({})
    event.old = post
    event.new = pre

    await loader.execute(command=None,
                         cmdtype="ServerChange",
                         event=event,
                         client=client)
Пример #2
0
async def on_voice_state_update(pre, post):
    event = Map({})
    event.old = pre
    event.new = post
    event.server = pre.server

    await loader.execute(command=None,
                         cmdtype="RoleRemove",
                         event=event,
                         client=client)
Пример #3
0
async def on_member_update(pre, post):

    event = Map({})
    event.old = pre
    event.new = post
    event.server = pre.server

    await loader.execute(command=None,
                         cmdtype="MemberUpdate",
                         event=event,
                         client=client)
Пример #4
0
async def on_server_emojis_update(post, pre):
    event = Map({})
    event.old = post
    event.new = pre
    event.server = post[0].server

    if len(old) < len(new):
        event.create = True
        # Sets emoji variable to the changed emoji
        event.emoji = [emoji for emoji in pre if emoji not in post][0]

    if len(old) > len(new):
        event.create = False
        # Sets emoji variable to the changed emoji
        event.emoji = [emoji for emoji in post if emoji not in pre][0]

    await loader.execute(command=None,
                         cmdtype="EmojiUpdate",
                         event=event,
                         client=client)
Пример #5
0
async def on_message_edit(pre, post):

    event = Map({})
    event.old = pre
    event.new = post
    event.message = post
    event.user = pre.author
    event.server = pre.server

    await loader.execute(command=None,
                         cmdtype="Edit",
                         event=event,
                         client=client)

    if not post.content.startswith(settings.PREFIX):
        return

    event.args = post.content[len(settings.PREFIX):].split(" ")
    command = post.content.split(" ")[0][len(settings.PREFIX):]
    # Execute any specific commands
    await loader.execute(command=command,
                         cmdtype="Command",
                         event=event,
                         client=client)