MCPcopy Create free account
hub / github.com/VJBots/VJ-Forward-Bot / STS

Class STS

plugins/utils.py:15–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13# Ask Doubt on telegram @KingVJ01
14
15class STS:
16 def __init__(self, id):
17 self.id = id
18 self.data = STATUS
19
20 def verify(self):
21 return self.data.get(self.id)
22
23 def store(self, From, to, skip, limit):
24 self.data[self.id] = {"FROM": From, 'TO': to, 'total_files': 0, 'skip': skip, 'limit': limit,
25 'fetched': skip, 'filtered': 0, 'deleted': 0, 'duplicate': 0, 'total': limit, 'start': 0}
26 self.get(full=True)
27 return STS(self.id)
28
29 def get(self, value=None, full=False):
30 values = self.data.get(self.id)
31 if not full:
32 return values.get(value)
33 for k, v in values.items():
34 setattr(self, k, v)
35 return self
36
37 def add(self, key=None, value=1, time=False, start_time=None):
38 if time:
39 return self.data[self.id].update({'start': tm.time() if start_time is None else start_time})
40 self.data[self.id].update({key: self.get(key) + value})
41
42 def divide(self, no, by):
43 by = 1 if int(by) == 0 else by
44 return int(no) / by
45
46 async def get_data(self, user_id):
47 bot = await db.get_bot(user_id)
48 if bot is None:
49 bot = await db.get_userbot(user_id)
50 k, filters = self, await db.get_filters(user_id)
51 size, configs = None, await db.get_configs(user_id)
52 if configs['duplicate']:
53 duplicate = True
54 else:
55 duplicate = False
56 try:
57 min = configs['min_size']
58 max = configs['max_size']
59 except:
60 min = 0
61 max = 0
62 button = parse_buttons(configs['button'] if configs['button'] else '')
63 return bot, configs['caption'], configs['forward_tag'], {'filters': filters,
64 'keywords': configs['keywords'], 'min_size': min, 'max_size': max, 'extensions': configs['extension'], 'skip_duplicate': duplicate, 'db_uri': configs['db_uri']}, configs['protect'], button
65
66# Don't Remove Credit Tg - @VJ_Botz
67# Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ

Callers 6

storeMethod · 0.85
pub_Function · 0.85
status_msgFunction · 0.85
restart_pending_forwadsFunction · 0.85
store_varsFunction · 0.85
runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected