示例#1
0
文件: bot.py 项目: codic12/HaxLib
import json

with open('token.txt') as f:

    HaxBotToken = f.read().strip('\n')

    f.close()

Gateway = Client(HaxBotToken)

HaxBot = client(HaxBotToken)

embeds = embeds.embeds

on_command = Gateway.events(CommandProcesser('hl:')).shortcut

from string import ascii_lowercase, ascii_uppercase

emojis = [
    '🇦', '🇧', '🇨', '🇩', '🇪', '🇫', '🇬', '🇭', '🇮',
    '🇯', '🇰', '🇱', '🇲', '🇳', '🇴', '🇵', '🇶', '🇷',
    '🇸', '🇹', '🇺', '🇻', '🇼', '🇽', '🇾', '🇿'
]

stuff = dict(zip(ascii_lowercase, emojis))

stuff.update(dict(zip(ascii_uppercase, emojis)))

trans = str.maketrans(stuff)
示例#2
0
import os
import importlib
from dotenv import load_dotenv
from hata import Client, start_clients, events, Embed

extensions = ("mew", "fun")

load_dotenv()
hata_client = Client(os.getenv("BOT_TOKEN"))
on_command = hata_client.events(events.CommandProcesser("!")).shortcut

for extension in extensions:
    module = importlib.import_module(f"extensions.{extension}")
    on_command.extend(module.extension)


@hata_client.events
class Ready:
    def __init__(self):
        self.called = False

    async def __call__(self, client):
        login_message = f" --> {client:f} ({client.id}) logged in UwU"

        if self.called:
            print(f"Reconnected {login_message}")
            return
        self.called = True

        await client.update_application_info()
        print(f"Hello {client.owner:f} {login_message}")
示例#3
0
    os.system(
        'pip3 install https://github.com/HuyaneMatsu/hata/archive/master.zip flask'
    )

from flask import Flask, request
import json
from hata import Client, start_clients, events, Embed, enter_executor
from hata.events import Pagination, ReactionAddWaitfor, ReactionDeleteWaitfor
from hata.extension_loader import ExtensionLoader, ExtensionError

from pdaddons.python.hata.interpreter import Interpreter

token = os.environ.get('TOKEN')
pdbot = Client(token)

on_command = pdbot.events(events.CommandProcesser(
    os.environ.get('PREFIX'))).shortcut

pdbot.events(ReactionAddWaitfor)
pdbot.events(ReactionDeleteWaitfor)

EXTENSION_LOADER = ExtensionLoader(pdbot)


def add_extensions():
    async def entry(client, lib):
        commands = getattr(lib, 'commands', None)
        if commands is not None:
            pdbot.events.message_create.shortcut.extend(commands)

        entry = getattr(lib, 'entry', None)
        if entry is not None:
示例#4
0
import os
import json

import json
from hata import Client, start_clients, events, Embed, enter_executor
from hata.events import Pagination, ReactionAddWaitfor, ReactionDeleteWaitfor
from hata.extension_loader import ExtensionLoader, ExtensionError

from pdaddons.python.hata.interpreter import Interpreter

token = os.environ.get('TOKEN')
pdbot = Client(token)

prefix = os.environ.get('PREFIX')
on_command = pdbot.events(events.CommandProcesser(prefix)).shortcut
del(prefix)
pdbot.events(ReactionAddWaitfor)
pdbot.events(ReactionDeleteWaitfor)


EXTENSION_LOADER = ExtensionLoader(pdbot)

def add_extensions():
    async def entry(client, lib):
        commands=getattr(lib,'commands',None)
        if commands is not None:
            pdbot.events.message_create.shortcut.extend(commands)

        entry=getattr(lib,'entry',None)
        if entry is not None:
            if is_coro(entry):