-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59d388b
commit 355f43e
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import discord | ||
from discord.ext import commands | ||
from discord.commands import ApplicationContext | ||
import os | ||
import logging | ||
import utils.logging | ||
from asyncio import sleep | ||
import pickle | ||
|
||
class Timer(commands.Cog): | ||
def __init__(self, bot: commands.Bot): | ||
self.bot = bot | ||
|
||
@commands.Cog.listener() | ||
async def on_message(message): | ||
if message.author.id == 218010938807287808: | ||
onemin_tuple = ( | ||
":sparkles:", | ||
":cloud_lightning:", | ||
":thunder_cloud_rain:", | ||
":cloud:", | ||
) | ||
tenmin_tuple = ":boom:" | ||
channel = bot.get_guild(message.reference.guild_id).get_channel( | ||
message.reference.channel_id | ||
) | ||
usercommand = await channel.fetch_message(message.reference.message_id) | ||
if os.path.isfile(f"{usercommand.author.id}.pkl"): | ||
if message.content.startswith(onemin_tuple): | ||
logger.info("Message detected.") | ||
await sleep(60) | ||
await channel.send(f"<@{usercommand.author.id}>님, 강화 쿨타임이 지났습니다.") | ||
elif message.content.startswith(tenmin_tuple): | ||
await sleep(600) | ||
await channel.send(f"<@{usercommand.author.id}>님, 강화 쿨타임이 지났습니다.") | ||
else: | ||
pass | ||
|
||
def setup(bot: commands.Bot): | ||
bot.add_cog(Timer(bot)) |