Esempio n. 1
0
    CONFIG['Username'] = '******' + me.username
    config.set_default()
    print(
        f"Starting... ID: {str(CONFIG['ID'])} , Username: {CONFIG['Username']}"
    )

    # 在这里加入功能
    from cmdproc import startcmd, rewardscmd, admincmd, weathercmd, infocmd, penaltiescmd, guesscmd, capitals, botadmincmd
    from cmdproc import youtubemusic, game24, storymakergame
    commands = startcmd.add_dispatcher(dispatcher)
    commands = admincmd.add_dispatcher(dispatcher)
    commands = rewardscmd.add_dispatcher(dispatcher)
    commands += weathercmd.add_dispatcher(dispatcher)
    commands += penaltiescmd.add_dispatcher(dispatcher)
    commands += guesscmd.add_dispatcher(dispatcher)
    commands += infocmd.add_dispatcher(dispatcher)
    commands += capitals.add_handler(dispatcher)
    commands += botadmincmd.add_dispatcher(dispatcher)
    commands += youtubemusic.add_dispatcher(dispatcher)
    commands += game24.add_handler(dispatcher)
    commands += storymakergame.add_handler(dispatcher)

    updater.bot.set_my_commands(commands)

    updater.start_polling()
    print('Started...')
    mysystemd.ready()

    updater.idle()
    print('Stopping...')
    print('Stopped.')
Esempio n. 2
0
    config.config_file = os.path.join(PATH, "config.json")
    try:
        CONFIG = config.load_config()
    except FileNotFoundError:
        print("config.json not found.Generate a new configuration file in %s" %
              config.config_file)
        config.set_default()
        sys.exit(2)

    updater = Updater(CONFIG['Token'], use_context=True)
    dispatcher = updater.dispatcher

    me = updater.bot.get_me()
    CONFIG['ID'] = me.id
    CONFIG['Username'] = '******' + me.username
    config.set_default()
    print('Starting... (ID: ' + str(CONFIG['ID']) + ', Username: '******'Username'] + ')')

    from cmdproc import groupcmd, infocmd
    commands = groupcmd.add_dispatcher(dispatcher)
    infocmd.add_dispatcher(dispatcher)
    updater.bot.set_my_commands(commands)

    updater.start_polling()
    print('Started')
    mysystemd.ready()

    updater.idle()
    print('Stopping...')
    print('Stopped.')