示例#1
0
    def getUserData(self, user_id):
        o = {
            'bannings': 0,
            'phrases': 0,
            'baduser': [],
        }

        for gid in self.bot_settings['configs']:
            for uid in tsutils.deepget(self.bot_settings,
                                       ['configs', gid, 'watchdog', 'users'],
                                       []):
                if user_id == tsutils.deepget(self.bot_settings, [
                        'configs', gid, 'watchdog', 'users', uid,
                        'request_user_id'
                ], -2141):
                    o['bannings'] += 1
            for phr in tsutils.deepget(self.bot_settings,
                                       ['configs', gid, 'watchdog', 'phrases'],
                                       []):
                if user_id == tsutils.deepget(self.bot_settings, [
                        'configs', gid, 'watchdog', 'phrases', phr,
                        'request_user_id'
                ], -2141):
                    o['phrases'] += 1
            if user_id in tsutils.deepget(
                    self.bot_settings, ['configs', gid, 'watchdog', 'users'],
                []):
                o['baduser'].append(self.bot_settings['configs'][gid]
                                    ['watchdog']['users'][user_id]['reason'])

        return o
示例#2
0
 def clearUserData(self, user_id):
     # Anonymize requesting banners and phrasemakers
     for gid in self.bot_settings['configs']:
         for uid in tsutils.deepget(self.bot_settings, ['configs', gid, 'watchdog', 'users'], []):
             if user_id == tsutils.deepget(self.bot_settings, ['configs', gid, 'watchdog', 'users', uid, 'request_user_id'], -2141):
                 self.bot_settings['configs'][gid]['watchdog']['users'][uid]['request_user_id'] = -1
         for phr in tsutils.deepget(self.bot_settings, ['configs', gid, 'watchdog', 'phrases'], []):
             if user_id == tsutils.deepget(self.bot_settings, ['configs', gid, 'watchdog', 'phrases', phr, 'request_user_id'], -2141):
                 self.bot_settings['configs'][gid]['watchdog']['phrases'][phr]['request_user_id'] = -1
     self.save_settings()
示例#3
0
    def clearUserDataFull(self, user_id):
        self.clearUserData(user_id)

        # Remove bannees
        for gid in self.bot_settings['configs']:
            if user_id in tsutils.deepget(self.bot_settings, ['configs', gid, 'watchdog', 'users'], []):
                del self.bot_settings['configs'][gid]['watchdog']['users'][user_id]
        self.save_settings()