mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<dataSource name="main">
|
<dataSource name="main">
|
||||||
<database-model serializer="dbm" dbms="SQLITE" family-id="SQLITE" format-version="4.43">
|
<database-model serializer="dbm" dbms="SQLITE" family-id="SQLITE" format-version="4.43">
|
||||||
<root id="1">
|
<root id="1"/>
|
||||||
<ServerVersion>3.39.2</ServerVersion>
|
|
||||||
</root>
|
|
||||||
<collation id="2" parent="1" name="RTRIM"/>
|
<collation id="2" parent="1" name="RTRIM"/>
|
||||||
<collation id="3" parent="1" name="NOCASE"/>
|
<collation id="3" parent="1" name="NOCASE"/>
|
||||||
<collation id="4" parent="1" name="BINARY"/>
|
<collation id="4" parent="1" name="BINARY"/>
|
||||||
|
|
|
@ -13,23 +13,26 @@ RTL = "\N{leftwards black arrow}\U0000fe0f"
|
||||||
|
|
||||||
class Events(commands.Cog):
|
class Events(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot: commands.Bot = bot
|
||||||
self.lupupa_warning_task.start()
|
self.lupupa_warning_task.start()
|
||||||
|
|
||||||
def cog_unload(self):
|
def cog_unload(self):
|
||||||
self.lupupa_warning_task.stop()
|
self.lupupa_warning_task.stop()
|
||||||
|
|
||||||
@tasks.loop(minutes=2)
|
@tasks.loop(minutes=30)
|
||||||
async def lupupa_warning_task(self):
|
async def lupupa_warning_task(self):
|
||||||
|
lupupa_warning_text = "\N{warning sign} Lupupa warning!!!"
|
||||||
if lupupa_warning and datetime.now().strftime("%A") == "Thursday":
|
if lupupa_warning and datetime.now().strftime("%A") == "Thursday":
|
||||||
now = datetime.now().time()
|
if self.bot.activity.name != lupupa_warning_text:
|
||||||
if (now.hour == 10 and now.minute in range(0, 2)) or (now.hour == 11 and now.minute in range(29, 32)):
|
await self.bot.change_presence(
|
||||||
channel = discord.utils.get(self.bot.get_guild(guilds[0]).text_channels, name="general")
|
activity=discord.Activity(
|
||||||
if channel and channel.can_send():
|
name=lupupa_warning_text,
|
||||||
await channel.send(
|
type=discord.ActivityType.watching
|
||||||
"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!"
|
status=discord.Status.dnd
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
await self.bot.change_presence()
|
||||||
|
|
||||||
@commands.Cog.listener("on_raw_reaction_add")
|
@commands.Cog.listener("on_raw_reaction_add")
|
||||||
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
|
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!")
|
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
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
console.log("Logged in as", bot.user)
|
console.log("Logged in as", bot.user)
|
||||||
|
|
Loading…
Reference in a new issue