mirror of
https://gitlab.com/ddorn/tfjm-discord-bot.git
synced 2025-12-14 20:45:15 +01:00
✨ CustomBot with full reload
This commit is contained in:
22
src/utils.py
22
src/utils.py
@@ -1,6 +1,12 @@
|
||||
import asyncio
|
||||
from typing import Sequence
|
||||
|
||||
import psutil
|
||||
from discord import Message
|
||||
from discord import Message, Member, User, Reaction
|
||||
from discord.ext.commands import Context, Bot
|
||||
from discord.utils import get
|
||||
|
||||
from src.constants import Emoji
|
||||
|
||||
|
||||
def has_role(member, role: str):
|
||||
@@ -9,17 +15,9 @@ def has_role(member, role: str):
|
||||
return any(r.name == role for r in member.roles)
|
||||
|
||||
|
||||
async def send_and_bin(bot: Bot, ctx: Context, msg=None, *, embed=None):
|
||||
"""Send a message and wait 5min for the author to delete it."""
|
||||
|
||||
message: Message = await ctx.send(msg, embed=embed)
|
||||
|
||||
await msg
|
||||
|
||||
|
||||
def start_time():
|
||||
def start_time(self):
|
||||
return psutil.Process().create_time()
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.send_and_bin = send_and_bin
|
||||
def setup(bot: Bot):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user