發布 V1.0.2:排行榜、手動換日、設定改用 md 格式、新預設值

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SahikandClaude Opus 5.5 committed 2026-11-07 22:09:10 +08:00
1 parent 9286b64518
commit f5a3b91783
8 files changed
+169 -29

No files matched your search

+16 -2
View File
@@ -8,6 +8,10 @@ import db
from config import TZ
def today() -> str:
return datetime.now(TZ).date().isoformat()
class Signin(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@@ -22,10 +26,9 @@ class Signin(commands.Cog):
if message.content.strip() != db.get_setting(guild_id, "signin_text"):
return
today = datetime.now(TZ).date().isoformat()
with db.conn:
signed = db.try_signin(
guild_id, message.author.id, db.get_setting(guild_id, "signin_reward"), today
guild_id, message.author.id, db.get_setting(guild_id, "signin_reward"), today()
)
if not signed:
return
@@ -46,6 +49,17 @@ class Signin(commands.Cog):
allowed_mentions=discord.AllowedMentions.none(), # 公開訊息,不要 tag 到自己
)
@app_commands.command(name="手動換日", description="讓今天簽過到的人可以再簽一次(管理員)")
@app_commands.guild_only()
@app_commands.default_permissions(administrator=True)
async def reset_day(self, interaction: discord.Interaction):
with db.conn:
count = db.reset_signin_day(interaction.guild_id, today())
await interaction.response.send_message(
f"🔄 已手動換日,今天已簽到的 {count} 位成員可以再簽到一次",
allowed_mentions=discord.AllowedMentions.none(),
)
async def setup(bot: commands.Bot):
await bot.add_cog(Signin(bot))