feat(bot): ✨ Send a message to the user when they find an easter egg.

This commit is contained in:
Nyeki.py
2024-10-21 15:46:23 -03:00
parent a4dd1f57dc
commit e52953ccca
6 changed files with 62 additions and 1 deletions
@@ -0,0 +1,11 @@
from tortoise import BaseDBAsyncClient
async def upgrade(db: BaseDBAsyncClient) -> str:
return """
ALTER TABLE "user" ADD "found_easter_eggs" SMALLINT NOT NULL DEFAULT 0;"""
async def downgrade(db: BaseDBAsyncClient) -> str:
return """
ALTER TABLE "user" DROP COLUMN "found_easter_eggs";"""
+2
View File
@@ -10,6 +10,7 @@ from discord import webhook
import aiohttp
from payphone.core import config, constants
from payphone.cogs.easter import EasterEggCommand
class User(models.Model):
@@ -17,6 +18,7 @@ class User(models.Model):
username: str = fields.CharField(max_length=32, db_index=True)
is_masked: bool = fields.BooleanField(default=False)
is_moderator: bool = fields.BooleanField(default=False)
found_easter_eggs: int = fields.IntEnumField(EasterEggCommand, default=0)
profiles: fields.BackwardFKRelation["Profile"]
call_rss: fields.BackwardFKRelation["CallUserChannelRelationship"]
leaderboard_position: int | None = fields.IntField(
+1 -1
View File
@@ -59,7 +59,7 @@ async def get_channel(channel: discord.TextChannel) -> models.Channel:
async def get_user(
user: discord.User | discord.Member,
) -> Tuple[models.User, models.Profile | None]:
) -> Tuple[models.User, models.Profile]:
"""Returns a user from the database, creating or updating it if it already exists.
Args: