Skip to content
/ Elaina Public

一个高性能的mirai sdk(基于mirai-api-http)

License

Notifications You must be signed in to change notification settings

wyapx/Elaina

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elaina

Codacy Badge

一个高性能的mirai sdk(基于mirai-api-http)

运行要求

Python 3.8+

Mirai-API-HTTP v2.0+

注:Mirai-API-HTTP需要启用ws adapter和http adapter

开始使用

from ela.app import Mirai
from ela.message.models import Plain

# 实例化类,以便接下来使用
mirai_app = Mirai("http://%host%:%port%/", qq=1234567890, verify_key="YourVerifyKeyHere")

@mirai_app.register("GroupMessage")  # 将一个函数绑定到一个事件上
async def on_groupmessage(app: Mirai, ev):
    # ev对应每一个事件的返回值
    if str(ev.messageChain) == "Hello":
        await app.sendGroupMessage(ev.group, [Plain("Hi")])
        
if __name__ == '__main__':
    mirai_app.run()
    # 若要启用断线重连,请使用下面的代码
    #from ela.utils import run_app
    #run_app(mirai_app)