Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
add daily function and deprecated function
Browse files Browse the repository at this point in the history
deprecated function is in the general helper for deprecation warnings (decorator)
  • Loading branch information
spookybear0 committed Oct 2, 2020
1 parent a4fa1a8 commit fc4ee85
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 10 additions & 2 deletions gdpys/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from aiohttp.payload_streamer import streamer
from helpers.userhelper import user_helper
from helpers.levelhelper import level_helper
from helpers.generalhelper import dict_keys
from helpers.generalhelper import dict_keys, deprecated
from helpers.timehelper import get_timestamp
from objects.comments import CommandContext, Comment, CommentBan
from constants import Permissions
from config import user_config
from exceptions import GDPySCommandError
from objects.levels import Level, Rating
from objects.levels import Level, Rating, DailyLevel

COMMANDS = {}

Expand Down Expand Up @@ -56,6 +56,14 @@ async def rate_level(self, rating: Rating):
"""Rates a level given a Rating object"""
return await level_helper.rate_level(rating)

async def get_daily_level(self) -> DailyLevel:
"""Get the current daily level"""
return await level_helper.get_daily_level()

#async def get_weekly_level(self) -> WeeklyLevel:
# """Get the current weekly level"""
# return await level_helper.get_weekly_level()

############################
# Commands #
############################
Expand Down
8 changes: 7 additions & 1 deletion helpers/generalhelper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#simple misc functions thaat aim to replace
import asyncio
import aiohttp
import logging
from typing import Union

def dict_keys(dictioary: dict) -> tuple:
"""Returns a tuple of all the dictionary keys."""
Expand Down Expand Up @@ -70,10 +72,14 @@ def string_bool(str_bool : str) -> bool:
return True
return False

def deprecated(func: Union[asyncio.coroutine, function]) -> Union[asyncio.coroutine, function]:
"""Decorator for deprecation warning"""
raise DeprecationWarning("Function is deprecated!")

class UpdateQueryBuilder():
"""Makes it simple to work with long update queries."""
def __init__(self, target_db : str):
"""Prepares that builder and sets tthe db."""
"""Prepares that builder and sets the db."""
self.TARGET_DB = target_db
self.where_conditions = []
self.where_params = []
Expand Down

0 comments on commit fc4ee85

Please sign in to comment.