def qqbot(host, port): nonebot.init() nonebot.load_plugins(os.path.join(os.path.dirname(__file__), 'plugins'), 'plugins') nonebot.run(host=host, port=port)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import nonebot from nonebot.adapters.cqhttp import Bot gids = {} # 此处放入指定群聊 nonebot.init(apscheduler_autostart=True) nonebot.init(apscheduler_config={ "apscheduler.timezone": "Asia/Shanghai" }) app = nonebot.get_asgi() driver = nonebot.get_driver() driver.register_adapter("cqhttp", Bot) nonebot.load_plugins("src/plugins") config = nonebot.get_driver().config config.GroupList = gids if __name__ == "__main__": nonebot.run(app="bot:app")
from os import path import sys import nonebot import db import config import config_debug import argparse from utils import init if __name__ == "__main__": paser = argparse.ArgumentParser() paser.add_argument("-d", "--debug", action="store_true", default=False) args = paser.parse_args(sys.argv[1:]) if args.debug == True: nonebot.init(config_debug) else: nonebot.init(config) init() bot = nonebot.get_bot() bot.server_app.before_serving(db.initdb) nonebot.load_plugins( path.join(path.dirname(__file__), "Pzzzzz", "plugins"), "Pzzzzz.plugins") nonebot.run()
app = nonebot.get_asgi() # 添加额外的配置 config = nonebot.get_driver().config config.home_dir_path = Path().resolve() # 插件数据目录 config.data_dir_path = config.home_dir_path / 'data' # 自定义 logger from nonebot.log import default_format, logger logger.add(config.data_dir_path / 'logs' / 'error.log', rotation='5 MB', diagnose=False, level='ERROR', format=default_format) # 加载外部插件 nonebot.load_plugin("nonebot_plugin_apscheduler") nonebot.load_plugins("src/plugins") # nonebot.load_plugin("nonebot_plugin_sentry") # 加载开发环境插件 if config.debug: nonebot.load_plugin('nonebot_plugin_test') nonebot.load_plugin('nonebot_plugin_docs') # 加载自己的插件 nonebot.load_plugins('plugins') if __name__ == '__main__': nonebot.run(app='bot:app')
def main(): nonebot.init(config) # nonebot.load_builtin_plugins() nonebot.load_plugins(path.join(path.dirname(__file__), 'awesome', 'plugins'),'qqbot.awesome.plugins') nonebot.run()
from os import path import nonebot, config if __name__ == "__main__": nonebot.init(config) nonebot.load_plugins(path.join(path.dirname(__file__), "plugins"), "plugins") nonebot.run(use_reloader=False)
""" main file """ import nonebot from os import path import bot.config.bot_config as config if __name__ == '__main__': nonebot.init(config) nonebot.load_plugins(path.join( path.dirname(__file__), 'bot', 'plugins', ), 'bot.plugins') nonebot.run(host=config.HOST, port=config.PORT)
def run(): nonebot.run(app="haruka_bot.cli.bot:app")
from os import path import nonebot import config if __name__ == "__main__": nonebot.init(config) nonebot.load_plugin("sdchaos.plugins.nmsl") nonebot.load_plugin("sdchaos.plugins.roll") nonebot.load_plugin("sdchaos.plugins.share_app_solver") nonebot.load_plugin("sdchaos.plugins.bili_search") nonebot.run(host="127.0.0.1", port=8080)
import nonebot from os import path import config import json if __name__ == '__main__': nonebot.init(config) nonebot.load_builtin_plugins() nonebot.load_plugins(path.join(path.dirname(__file__), "kenia"), "kenia") nonebot.run(host='0.0.0.0', port=8080) # 类flask
#!/usr/bin/env python3 __author__ = "Yxzh" import nonebot as n import config if __name__ == "__main__": n.init(config) n.load_plugins("./PineBOT/plugin/", "PineBOT.plugin") n.run()
# -*- coding: utf-8 -*- # Author:w k import nonebot as nb import config import os if __name__ == '__main__': nb.init(config) nb.load_plugins(os.path.join(os.path.dirname(__file__), 'gadget\plugins'), 'gadget.plugins') nb.run(host='127.0.0.1', port=8080)
from os import path import config import nonebot if __name__ == '__main__': nonebot.init(config) nonebot.load_plugins(path.join(path.dirname(__file__), 'plugins'), 'plugins') nonebot.run(host='127.0.0.1', port=52521)
from os import path import nonebot import config if __name__ == "__main__": nonebot.init(config) nonebot.load_plugins(path.join(path.dirname(__file__), 'qqbot', 'plugins'), 'qqbot.plugins') nonebot.run(host='127.0.0.1', port=9900)
from os import path import nonebot as nb import config if __name__ == '__main__': nb.init(config) nb.load_plugins( path.join(path.dirname(__file__), 'ALLplugins', 'plugins'), 'ALLplugins.plugins' ) nb.run()
import logging import os import nonebot if __name__ == '__main__': logging.basicConfig(level=logging.INFO) if dsn := os.environ.get("TELEMETRY", ""): import sentry_sdk sentry_sdk.init(dsn, release=os.environ.get("TELEMETRY_RELEASE", None)) nonebot.init() # nonebot.load_builtin_plugins() nonebot.load_plugins( os.path.join(os.path.dirname(__file__), 'observatory', 'plugins'), 'observatory.plugins' ) nonebot.run(host="0.0.0.0", port=8080)
from os import path import nonebot import config if __name__ == '__main__': nonebot.init(config) #将config作为配置对象传给noneot.init函数 #加载插件 nonebot.load_plugins( path.join(path.dirname(__file__), 'awesome', 'plugins'), 'awesome.plugins') nonebot.load_builtin_plugins() #加载notebot内置的插件 nonebot.run() #在地址127.0.0.1:8080运行notebot
import nonebot import config from os import path # 小心端口被占用 if __name__ == '__main__': nonebot.init(config) # 必须在使用NoneBot的任何功能之前调用 (必须要有) # nonebot.load_builtin_plugins() # 加载了NoneBot的内置插件,不是必须的 nonebot.load_plugins( path.join(path.dirname(__file__), 'awesome', 'plugins'), 'awesome.plugins') nonebot.run() # host='127.0.0.1', port='8080'
'.' ) / 'logs' / 'error' / f"{datetime.datetime.now().strftime('%Y%m%d-%H%M%S')}-ERROR.log" nonebot.init(debug=bool(config['debug']), superusers=set(config['superusers']), nickname=set(config['nickname']), command_start=set(config['command_start']), command_sep=set(config['command_sep'])) app = nonebot.get_asgi() driver = nonebot.get_driver() driver.register_adapter("cqhttp", CQHTTPBot) nonebot.load_plugins('ATRI/plugins') logger.add(LOGGER_INFO_PATH, rotation='10 MB', diagnose=False, level='INFO', format=default_format) logger.add(LOGGER_ERROR_PATH, rotation='10 MB', diagnose=False, level='ERROR', format=default_format) if __name__ == "__main__": logger.info("Running ATRI...") nonebot.run(app='bot:app', host=config['host'], port=config['port'])
import nonebot from script import config if __name__ == '__main__': nonebot.init(config) nonebot.load_builtin_plugins() nonebot.run(host='127.0.0.1', port=8888)
parser.add_argument('-d', '--dev', action='store_true', default=False, help='Enable the developing mode') args = parser.parse_args() if not args.dev: # save the logs to disk in non-developing mode logger.add("logs/errors_{time}.log", rotation="00:00", diagnose=False, level="ERROR", format=default_format) # initialize the bot nonebot.init(debug=args.dev, fastapi_reload_dirs=['littlefish'], command_start=['']) driver = nonebot.get_driver() driver.register_adapter("cqhttp", Bot) nonebot.load_plugin('nonebot_plugin_apscheduler') nonebot.load_plugins('littlefish') if args.dev: app = nonebot.get_asgi() # load the ASGI app nonebot.load_plugin( 'nonebot_plugin_test') # enable the test frontend in developing mode if __name__ == '__main__': nonebot.run(app='bot:app' * args.dev)
IAIbot 初始化模块 初始化系统,连接数据库,加载插件 author: 16030199025 张俊华 """ from os import path import sys import setup import os import nonebot as none sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))) import IAI.iai.common.cache as cache if __name__ == '__main__': sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))) none.init(setup) bot = none.get_bot() bot.server_app.before_serving(cache.init) none.load_builtin_plugins() none.load_plugins(path.join(path.dirname(__file__), 'iai', 'plugins'), 'iai.plugins') none.run()
import nonebot import config from os import path # from awesome.plugins.plugin import roll_expression if __name__ == '__main__': nonebot.init(config) nonebot.load_builtin_plugins() nonebot.load_plugins( path.join(path.dirname(__file__), 'awesome', 'plugins'), 'awesome.plugins') nonebot.run(host='0.0.0.0', port=8084)
import nonebot import importlib if __name__ == '__main__': nonebot.init(importlib.import_module('config')) nonebot.load_plugins('./plugins', 'plugins') nonebot.run(host='0.0.0.0', port=1234)
# logger.add("error.log", # rotation="00:00", # diagnose=False, # level="ERROR", # format=default_format) # You can pass some keyword args config to init function nonebot.init() app = nonebot.get_asgi() driver = nonebot.get_driver() driver.register_adapter(ONEBOT_V11Adapter) nonebot.load_builtin_plugins("echo") nonebot.load_plugins("nonebot_plugin_astrologian/plugins") # Please DO NOT modify this file unless you know what you are doing! # As an alternative, you should use command `nb` or modify `pyproject.toml` to load plugins # nonebot.load_from_toml("pyproject.toml") # Modify some config / config depends on loaded configs # # config = driver.config # do something... if __name__ == "__main__": logger.warning( "Always use `nb run` to start the bot instead of manually running!") nonebot.run(app="__mp_main__:app")
def start(): nonebot.init() nonebot.load_builtin_plugins() nonebot.run(host='127.0.0.1', port=8080)
daemon=True) keepalive['tweetsocketServer_threads'].start() async def DealAndKeepAlive(): while True: await asyncio.sleep(1) if keepalive['reboot_tewwtlistener'] == True: reboot_tewwtlistener() if __name__ == "__main__": #初始化 init() #启动线程 #logger.info('启动nonebot...') #nonebot_threads_run() time.sleep(2) logger.info('启动推特流...') tweetListener_threads_run() logger.info('启动nonebot...') nonebot.init(config) nonebot.load_plugins(path.join(path.dirname(__file__), 'plugins'), 'plugins') nonebot.run(host=config.NONEBOT_HOST, port=config.NONEBOT_PORT) logger.info('维持主线程运行...') loop = asyncio.get_event_loop() loop.run_until_complete(DealAndKeepAlive())
import os import nonebot import logging from config_manager import config if __name__ == '__main__': config.load() nonebot.init() nonebot.load_plugins( os.path.join(os.path.dirname(__file__), 'bot_plugins'), 'bot_plugins') logging.getLogger().setLevel(logging.WARNING) nonebot.run(host=config.bot_listen_host, port=config.bot_listen_port)
# -*- coding = utf-8 -*- # @Time : 2020/5/11 9:28 # @Author : AX # @File : bot.py # @Software: PyCharm import nonebot import qqbot.config if __name__ == '__main__': nonebot.init(config_object=qqbot.config) nonebot.load_builtin_plugins() nonebot.run(host='127.0.0.1', port=8080)
''' @desc: FG主入口 @author: Martin Huang @time: created on 2020/4/4 14:57 @修改记录: ''' import os from Utils.JsonUtils import JsonUtils import nonebot import config if __name__ == '__main__': configuration = JsonUtils.json2Dict(os.path.join(os.getcwd(), 'cn', 'acmsmu', 'FG', 'data', 'config.json')) nonebot.init(config) nonebot.load_plugins( os.path.join(os.path.dirname(__file__), 'cn', 'acmsmu'), 'cn.acmsmu' ) nonebot.run(host=configuration['nonebotHost'], port=configuration['nonebotPort'])