Giter VIP home page Giter VIP logo

Comments (4)

stdrc avatar stdrc commented on July 21, 2024

使用 aiocqhttp 的接口,下面这个相当于和 NoneBot 的处理函数平级,完全互不影响且每条消息一定会触发

bot = none.get_bot()

@bot.on_message
async def _(bot, ctx):
    pass

from nonebot.

ImSingee avatar ImSingee commented on July 21, 2024

OK 感谢!

希望把这个和 bot.on_meta_event 的写进 none 的文档吧,找了好久……

from nonebot.

ImSingee avatar ImSingee commented on July 21, 2024

另外,似乎这种写法更符合 none 的风格

import none
from none.typing import Context_T
from none.log import logger

bot = none.get_bot()


@bot.on_message()
async def _(ctx: Context_T):
    logger.debug(f'收到消息:{ctx["message"]}')

from nonebot.

stdrc avatar stdrc commented on July 21, 2024

噢噢等下,我刚刚写错了,确实是只有 ctx 这一个参数,具体你去看下 aiocqhttp 的 README

from nonebot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.