def __init__(self, token, group_id, debug=True): Vk.__init__(self, token=token, group_id=group_id, debug=debug) self.messages_to_delete = {} self.userbot = UserBot() self.debug = True base = BetterBotBase("users", "dat") #base.addPattern("rating", 0) base.addPattern("karma", 0) base.addPattern("programming_languages", []) base.addPattern("github_profile", "") #base.addPattern("current", []) base.addPattern("supporters", []) #base.addPattern("current_sub", []) base.addPattern("opponents", []) base.addPattern("last_collective_vote", 0) #xusers = base.getSortedByKeys("karma", otherKeys=["current", "current_sub"]) #for xuser in xusers: # uuser = base.load(xuser["uid"]) # uuser.supporters = [] # uuser.opponents = [] # uuser.karma = 0 # base.save(uuser) self.base = base
def __init__(self, token, group_id, debug=True): Vk.__init__(self, token=token, group_id=group_id, debug=debug) self.messages_to_delete = {} self.userbot = UserBot() self.debug = True base = BetterBotBase("users", "dat") base.addPattern("karma", 0) base.addPattern("programming_languages", []) base.addPattern("github_profile", "") base.addPattern("supporters", []) base.addPattern("opponents", []) base.addPattern("last_collective_vote", 0) self.base = base
def __init__( self, token: str, group_id: int, debug: bool = True ): """Auth as VK group and register commands. """ Vk.__init__(self, token=token, group_id=group_id, debug=debug) self.messages_to_delete = {} self.userbot = UserBot() self.data = BetterBotBaseDataService() self.commands = Commands(self, self.data) self.commands.register_cmds( (patterns.HELP, self.commands.help_message), (patterns.INFO, self.commands.info_message), (patterns.UPDATE, self.commands.update_command), (patterns.ADD_PROGRAMMING_LANGUAGE, lambda: self.commands.change_programming_language(True)), (patterns.REMOVE_PROGRAMMING_LANGUAGE, lambda: self.commands.change_programming_language(False)), (patterns.ADD_GITHUB_PROFILE, lambda: self.commands.change_github_profile(True)), (patterns.REMOVE_GITHUB_PROFILE, lambda: self.commands.change_github_profile(False)), (patterns.KARMA, self.commands.karma_message), (patterns.TOP, self.commands.top), (patterns.PEOPLE, self.commands.top), (patterns.BOTTOM, lambda: self.commands.top(True)), (patterns.TOP_LANGUAGES, self.commands.top_langs), (patterns.PEOPLE_LANGUAGES, self.commands.top_langs), (patterns.BOTTOM_LANGUAGES, lambda: self.commands.top_langs(True)), (patterns.APPLY_KARMA, self.commands.apply_karma), )
def __init__(self): Vk.__init__(self, token=BotToken, group_id=bot_group_id, debug=True) self.messages_to_delete = {} self.userbot = UserBot() self.debug = True