# bot类 bot = IOTBOT(configuration.qq, use_plugins=True, plugin_dir=args.plugin_dir, log_file_path=args.log_path) action = Action(bot) # 插件控制类 plugins = PluginControl() # admin命令接受 from admin.admin_else import admin_else_group, admin_else_friend bot.add_group_msg_receiver(admin_else_group) bot.add_friend_msg_receiver(admin_else_friend) from admin.admin_refresh import admin_refresh_group, admin_refresh_friend bot.add_group_msg_receiver(partial(admin_refresh_group, bot)) bot.add_friend_msg_receiver(partial(admin_refresh_friend, bot)) from admin.admin_test import admin_test_group, admin_test_friend bot.add_group_msg_receiver(admin_test_group) bot.add_friend_msg_receiver(admin_test_friend) from admin.admin_blacklist import admin_blacklist_group bot.add_group_msg_receiver(admin_blacklist_group)
def on_group_msg(ctx: GroupMsg): print(ctx.message) if ctx.Content == '刷新插件': bot.refresh_plugins() if ctx.Content == '.test': action.send_group_pic_msg(ctx.FromGroupId, 'https://t.cn/A6Am7xYO') @bot.on_friend_msg def on_friend_msg(ctx: FriendMsg): print(ctx.message) if ctx.Content == '.test': action.send_friend_pic_msg(ctx.FromUin, picUrl='https://t.cn/A6Am7xYO') @bot.on_event def on_event(ctx: EventMsg): print(ctx.message) print(ctx.EventName) def test_group(ctx: GroupMsg): print('In test_group', ctx.FromNickName) bot.add_group_msg_receiver(test_group) if __name__ == "__main__": print(bot.receivers) bot.run()