Skip to content

Commit

Permalink
final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 committed Mar 16, 2020
1 parent 9db6e6c commit 7814851
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 1 addition & 2 deletions userge/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@


if __name__ == "__main__":
log.info("starting Userge...")
userge.run()
userge.begin()
18 changes: 13 additions & 5 deletions userge/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
class Userge(Client):

HELP_DICT = {}
USERGE_MAIN_STRING = "<<<! ##### ___{}___ ##### !>>>"
USERGE_SUB_STRING = "<<<! {} !>>>"

def __init__(self):
self.log = logging.getLogger(__name__)

self.log.info("setting configs...")
self.log.info(self.USERGE_MAIN_STRING.format("Setting Userge Configs"))

super().__init__(
Config.HU_STRING_SESSION,
Expand All @@ -21,21 +23,27 @@ def __init__(self):
)

def getLogger(self, name: str):
self.log.info(f"creating new logger => {name}")
self.log.info(self.USERGE_SUB_STRING.format(f"Creating Logger => {name}"))
return logging.getLogger(name)

def on_cmd(self, command: str):
self.log.info(f"setting new command => {command}")

def decorator(func):

self.log.info(self.USERGE_SUB_STRING.format(f"Loading => [ async def {func.__name__}(client, message) ] On .{command} Command"))
dec = self.on_message(Filters.regex(pattern=f"^.{command}") & Filters.me)
return dec(func)

return decorator

def add_help(self, command: str, about: str):
self.log.info(f"help dict updated {command} : {about}")
self.log.info(self.USERGE_SUB_STRING.format(f"Help Dict Updating => [ {command} : {about} ]"))
self.HELP_DICT.update({command: about})

def get_help(self, key: str = None) -> dict:
return self.HELP_DICT[key] if key else self.HELP_DICT
return self.HELP_DICT[key] if key else self.HELP_DICT

def begin(self):
self.log.info(self.USERGE_MAIN_STRING.format("Starting Userge"))
self.run()
self.log.info(self.USERGE_MAIN_STRING.format("Exiting Userge"))

0 comments on commit 7814851

Please sign in to comment.