File size: 989 Bytes
ca4eb6d
 
 
 
 
11ae35a
ca4eb6d
89ad488
ca4eb6d
 
 
 
 
 
89a7a7a
6cef7ec
89a7a7a
 
 
 
 
 
 
7eeba00
 
 
 
 
 
 
89a7a7a
7eeba00
 
ea508b7
 
 
 
 
 
6cef7ec
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
async def all_plugins():
    # This generates a list of plugins in this folder for the * in __main__ to
    # work.

    from glob import glob
    from os.path import basename, dirname, isfile

    mod_paths = glob(f"{dirname(__file__)}/*.py")
    all_plugs = [
        basename(f)[:-3]
        for f in mod_paths
        if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py")
    ]
    return sorted(all_plugs)


from sys import exit as exiter

from pymongo import MongoClient
from pymongo.errors import PyMongoError

from Powers import BDB_URI, LOGGER

if BDB_URI:
    try:
        BIRTHDAY_DB = MongoClient(BDB_URI)
    except PyMongoError as f:
        LOGGER.error(f"Error in Mongodb2: {f}")
        exiter(1)
    Birth_main_db = BIRTHDAY_DB["birthdays"]

    bday_info = Birth_main_db['users_bday']
    bday_cinfo = Birth_main_db["chat_bday"]

from datetime import datetime


def till_date(date):
    form = "%Y-%m-%d %H:%M:%S"
    return datetime.strptime(date, form)