-
Notifications
You must be signed in to change notification settings - Fork 19
/
helpers.py
51 lines (38 loc) · 1.01 KB
/
helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Don't Edit
# temp db for banned
import asyncio
import logging
import traceback
import aiohttp
import database
from config import ADMINS
class temp(object): # TrojanZ Idea of Temping
BOT_USERNAME = None
CANCEL = False
FIRST_NAME = None
START_TIME = None
BANNED_USERS = []
class AsyncIter:
def __init__(self, items):
self.items = items
async def __aiter__(self):
for item in self.items:
yield item
async def __anext__(self):
try:
return next(self.iter)
except StopIteration as e:
raise StopAsyncIteration from e
class Helpers:
def __init__(self):
self.username = temp.BOT_USERNAME
@property
async def user_method(self):
user_method = await database.db.get_bot_method(self.username)
return user_method or "None"
@property
async def get_admins(self):
x=''
async for i in AsyncIter(ADMINS):
x+= f"~ `{i}`\n"
return x