mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Lupupa warning now uses status instead of a message
This commit is contained in:
parent
d2117aed33
commit
f3e4e88ffd
3 changed files with 19 additions and 13 deletions
|
@ -1,9 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dataSource name="main">
|
||||
<database-model serializer="dbm" dbms="SQLITE" family-id="SQLITE" format-version="4.43">
|
||||
<root id="1">
|
||||
<ServerVersion>3.39.2</ServerVersion>
|
||||
</root>
|
||||
<root id="1"/>
|
||||
<collation id="2" parent="1" name="RTRIM"/>
|
||||
<collation id="3" parent="1" name="NOCASE"/>
|
||||
<collation id="4" parent="1" name="BINARY"/>
|
||||
|
|
|
@ -13,23 +13,26 @@ RTL = "\N{leftwards black arrow}\U0000fe0f"
|
|||
|
||||
class Events(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.bot: commands.Bot = bot
|
||||
self.lupupa_warning_task.start()
|
||||
|
||||
def cog_unload(self):
|
||||
self.lupupa_warning_task.stop()
|
||||
|
||||
@tasks.loop(minutes=2)
|
||||
@tasks.loop(minutes=30)
|
||||
async def lupupa_warning_task(self):
|
||||
lupupa_warning_text = "\N{warning sign} Lupupa warning!!!"
|
||||
if lupupa_warning and datetime.now().strftime("%A") == "Thursday":
|
||||
now = datetime.now().time()
|
||||
if (now.hour == 10 and now.minute in range(0, 2)) or (now.hour == 11 and now.minute in range(29, 32)):
|
||||
channel = discord.utils.get(self.bot.get_guild(guilds[0]).text_channels, name="general")
|
||||
if channel and channel.can_send():
|
||||
await channel.send(
|
||||
"Uh oh, Lupupa warning! Make sure you've got your essays written in academic style in Microsoft"
|
||||
" Word on your pen drive! You aren't in primary school anymore!"
|
||||
if self.bot.activity.name != lupupa_warning_text:
|
||||
await self.bot.change_presence(
|
||||
activity=discord.Activity(
|
||||
name=lupupa_warning_text,
|
||||
type=discord.ActivityType.watching
|
||||
),
|
||||
status=discord.Status.dnd
|
||||
)
|
||||
else:
|
||||
await self.bot.change_presence()
|
||||
|
||||
@commands.Cog.listener("on_raw_reaction_add")
|
||||
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
|
||||
|
|
5
main.py
5
main.py
|
@ -30,6 +30,11 @@ async def on_connect():
|
|||
console.log("[green]Connected to discord!")
|
||||
|
||||
|
||||
@bot.listen("on_application_command_error")
|
||||
async def on_application_command_error(ctx: discord.ApplicationContext, error: Exception):
|
||||
await ctx.respond("Application Command Error: `%r`" % error)
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
console.log("Logged in as", bot.user)
|
||||
|
|
Loading…
Reference in a new issue