示例#1
0
文件: bot.py 项目: za123/none-bot
from os import path

import none

import config

if __name__ == '__main__':
    none.init(config)
    none.load_plugins(path.join(path.dirname(__file__), 'awesome', 'plugins'),
                      'awesome.plugins')
    none.run()
import none
import os
import config

if __name__ == '__main__':
    none.init(config)
    none.load_builtin_plugins()
    none.load_plugins(os.path.join(os.path.dirname(__file__), 'plugins'),
                      'plugins')
    none.run(host='127.0.0.1', port=8080)
示例#3
0
文件: bot.py 项目: DoubleHYH/none-bot
import none

import config

if __name__ == '__main__':
    none.init(config)
    none.load_builtin_plugins()
    none.run()
示例#4
0
@none.on_command('echo')
async def _(session: none.CommandSession):
    await session.send(session.get_optional('message') or session.current_arg)


@none.scheduler.scheduled_job('cron', minute='*/5')
async def _():
    none.logger.info("Running scheduled Job")
    loadConfig()

    bot = none.get_bot()
    tmp = rss("db").query(URLS)
    for i, post in enumerate(tmp):
        text = []
        text.append({"type": "text", "data": {"text": f'{post.title}\n'}})
        text.append({"type": "text", "data": {"text": f'发布于 {post.author}\n'}})
        text.append({"type": "text", "data": {"text": f'{post.link}'}})
        none.logger.info(text)
        try:
            for num in QQGroup:
                await bot.send_group_msg(group_id=num, message=text)
        except CQHttpError:
            pass


if __name__ == '__main__':
    loadConfig()
    none.init()
    none.run(host='172.17.0.1', port=8080)
示例#5
0
from os import path

import none
from demo import config

none.init(config)


@none.scheduler.scheduled_job('interval', seconds=20)
async def cb():
    bot_ = none.get_bot()
    try:
        await bot_.send_private_msg(user_id=1002647525, message='哇')
    except Exception as e:
        none.logger.exception(e)


if __name__ == '__main__':
    none.load_builtin_plugins()
    none.load_plugins(path.join(path.dirname(__file__), 'plugins'),
                      'demo.plugins')
    none.run(host=config.HOST, port=config.PORT)
示例#6
0
from os import path

import none
from none_demo import config

none.init(config)
app = none.get_bot().asgi

if __name__ == '__main__':
    none.load_builtin_plugins()
    none.load_plugins(path.join(path.dirname(__file__), 'plugins'),
                      'none_demo.plugins')
    none.run(host=config.HOST, port=config.PORT)