1
0
mirror of https://gitlab.com/ddorn/tfjm-discord-bot.git synced 2025-12-14 20:45:15 +01:00

hug back and hugs stats

This commit is contained in:
ddorn
2020-05-17 15:06:37 +02:00
parent 42faffb7dd
commit 7f32524ead
3 changed files with 185 additions and 33 deletions

View File

@@ -1,4 +1,5 @@
from functools import wraps
from typing import Union
import psutil
from discord.ext.commands import Bot
@@ -17,10 +18,13 @@ def french_join(l):
return f"{start} et {l[-1]}"
def has_role(member, role: str):
def has_role(member, role: Union[str, tuple]):
"""Return whether the member has a role with this name."""
return any(r.name == role for r in member.roles)
if isinstance(role, str):
return any(r.name == role for r in member.roles)
else:
return any(r.name == rol for r in member.roles for rol in role)
def send_and_bin(f):