cleanup
This commit is contained in:
@@ -17,8 +17,6 @@ from aiohttp import ClientSession, ClientTimeout
|
||||
from discord.ext import bridge, commands, tasks
|
||||
from disc_havoc import Havoc
|
||||
|
||||
|
||||
|
||||
class Util:
|
||||
"""Karma Utility"""
|
||||
def __init__(self, bot: Havoc):
|
||||
@@ -34,10 +32,11 @@ class Util:
|
||||
async def get_karma(self, keyword: str) -> int:
|
||||
"""
|
||||
Get Karma for Keyword
|
||||
|
||||
Args:
|
||||
keyword (str)
|
||||
Returns:
|
||||
int|str
|
||||
int
|
||||
"""
|
||||
try:
|
||||
async with ClientSession() as session:
|
||||
@@ -56,10 +55,11 @@ class Util:
|
||||
async def get_top(self, n: int = 10) -> Optional[dict]:
|
||||
"""
|
||||
Get top (n=10) Karma
|
||||
|
||||
Args:
|
||||
n (int): Number of top results to return, default 10
|
||||
Returns:
|
||||
Optional[dict]
|
||||
Optional[dict]
|
||||
"""
|
||||
try:
|
||||
async with ClientSession() as session:
|
||||
@@ -80,10 +80,11 @@ class Util:
|
||||
async def get_top_embed(self, n:int = 10) -> Optional[discord.Embed]:
|
||||
"""
|
||||
Get Top Karma Embed
|
||||
|
||||
Args:
|
||||
n (int): Number of top results to return, default 10
|
||||
Returns:
|
||||
discord.Embed
|
||||
Optional[discord.Embed]
|
||||
"""
|
||||
top: Optional[dict] = await self.get_top(n)
|
||||
if not top:
|
||||
@@ -101,11 +102,14 @@ class Util:
|
||||
"""
|
||||
Update Karma for Keyword
|
||||
Args:
|
||||
|
||||
display (str): Display name of the user who requested the update
|
||||
_id (int): Discord UID of the user who requested the update
|
||||
keyword (str): Keyword to update
|
||||
flag (int)
|
||||
"""
|
||||
Returns:
|
||||
bool
|
||||
"""
|
||||
if not flag in [0, 1]:
|
||||
return False
|
||||
|
||||
@@ -134,6 +138,7 @@ class Util:
|
||||
async def check_cooldown(self, user_id: int) -> bool:
|
||||
"""
|
||||
Check if member has met cooldown period prior to adjusting karma
|
||||
|
||||
Args:
|
||||
user_id (int): The Discord UID to check
|
||||
Returns:
|
||||
|
||||
Reference in New Issue
Block a user