diff --git a/README.md b/README.md index 7b70fc5..582c4a0 100644 --- a/README.md +++ b/README.md @@ -261,7 +261,6 @@ GOMOKU_MAX_CONCURRENT_GAMES=5 .签到 # 每日签到 .打卡 # 每日签到 .points leaderboard # 积分排行榜 -.points records # 积分记录 ``` ### 炼金系统 diff --git a/core/database.py b/core/database.py index 1472cc2..3e64e10 100644 --- a/core/database.py +++ b/core/database.py @@ -362,13 +362,9 @@ class Database: # 更新用户积分 cursor.execute(""" - INSERT INTO user_points (user_id, points, created_at, updated_at) - VALUES (?, ?, ?, ?) - ON CONFLICT(user_id) - DO UPDATE SET - points = points + ?, - updated_at = ? - """, (user_id, points, current_time, current_time, points, current_time)) + INSERT OR REPLACE INTO user_points (user_id, points, created_at, updated_at) + VALUES (?, COALESCE((SELECT points FROM user_points WHERE user_id = ?), 0) + ?, ?, ?) + """, (user_id, user_id, points, current_time, current_time)) logger.info(f"用户 {user_id} 成功获得 {points} 积分,来源:{source}") return True @@ -468,14 +464,9 @@ class Database: # 更新积分和签到日期 cursor.execute(""" - INSERT INTO user_points (user_id, points, last_checkin_date, created_at, updated_at) - VALUES (?, ?, ?, ?, ?) - ON CONFLICT(user_id) - DO UPDATE SET - points = points + ?, - last_checkin_date = ?, - updated_at = ? - """, (user_id, points, today, current_time, current_time, points, today, current_time)) + INSERT OR REPLACE INTO user_points (user_id, points, last_checkin_date, created_at, updated_at) + VALUES (?, COALESCE((SELECT points FROM user_points WHERE user_id = ?), 0) + ?, ?, ?, ?) + """, (user_id, user_id, points, today, current_time, current_time)) # 验证积分是否真的增加了 points_after = self.get_user_points(user_id) diff --git a/data/bot.db b/data/bot.db deleted file mode 100644 index d3d74c4..0000000 Binary files a/data/bot.db and /dev/null differ diff --git a/data/fortunes.json b/data/fortunes.json deleted file mode 100644 index 5083a91..0000000 --- a/data/fortunes.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "fortunes": [ - { - "level": "大吉", - "color": "#FF4757", - "emoji": "🌟", - "description": "今天运势爆棚!做什么都顺利,是实现愿望的好日子!", - "advice": "抓住机会,勇敢行动!" - }, - { - "level": "吉", - "color": "#FF6348", - "emoji": "✨", - "description": "运势不错,事情会朝着好的方向发展。", - "advice": "保持积极心态,好运自然来。" - }, - { - "level": "中吉", - "color": "#FFA502", - "emoji": "🍀", - "description": "平稳的一天,虽无大喜但也无大忧。", - "advice": "脚踏实地,稳中求进。" - }, - { - "level": "小吉", - "color": "#F79F1F", - "emoji": "🌈", - "description": "有一些小确幸会出现,注意把握。", - "advice": "留心身边的小美好。" - }, - { - "level": "平", - "color": "#A3A3A3", - "emoji": "☁️", - "description": "平淡的一天,没有特别的起伏。", - "advice": "平常心对待,顺其自然。" - }, - { - "level": "小凶", - "color": "#747D8C", - "emoji": "🌧️", - "description": "可能会遇到一些小困难,需要谨慎应对。", - "advice": "小心行事,三思而后行。" - }, - { - "level": "凶", - "color": "#57606F", - "emoji": "⚡", - "description": "今天不太顺利,建议低调行事。", - "advice": "韬光养晦,静待时机。" - } - ], - "tarot": [ - { - "name": "愚者", - "emoji": "🃏", - "meaning": "新的开始、冒险、天真", - "advice": "勇敢踏出第一步,迎接新的旅程。" - }, - { - "name": "魔术师", - "emoji": "🎩", - "meaning": "创造力、技能、意志力", - "advice": "发挥你的才能,创造属于自己的奇迹。" - }, - { - "name": "女祭司", - "emoji": "🔮", - "meaning": "直觉、神秘、内在智慧", - "advice": "倾听内心的声音,答案就在你心中。" - }, - { - "name": "皇后", - "emoji": "👑", - "meaning": "丰盛、养育、美好", - "advice": "享受生活的美好,善待自己和他人。" - }, - { - "name": "皇帝", - "emoji": "⚔️", - "meaning": "权威、秩序、掌控", - "advice": "建立规则,掌控局面。" - }, - { - "name": "恋人", - "emoji": "💕", - "meaning": "爱情、选择、和谐", - "advice": "跟随你的心,做出正确的选择。" - }, - { - "name": "战车", - "emoji": "🏎️", - "meaning": "胜利、决心、前进", - "advice": "坚定信念,勇往直前。" - }, - { - "name": "力量", - "emoji": "💪", - "meaning": "勇气、耐心、内在力量", - "advice": "发掘内在的力量,温柔而坚定。" - }, - { - "name": "隐士", - "emoji": "🕯️", - "meaning": "内省、寻找、孤独", - "advice": "静下心来,寻找内心的答案。" - }, - { - "name": "命运之轮", - "emoji": "🎡", - "meaning": "转变、命运、循环", - "advice": "接受变化,一切都在轮转中。" - }, - { - "name": "正义", - "emoji": "⚖️", - "meaning": "公平、真相、因果", - "advice": "坚持正义,真相终会大白。" - }, - { - "name": "星星", - "emoji": "⭐", - "meaning": "希望、灵感、宁静", - "advice": "保持希望,光明就在前方。" - }, - { - "name": "月亮", - "emoji": "🌙", - "meaning": "潜意识、幻想、不确定", - "advice": "信任直觉,但要分辨幻想与现实。" - }, - { - "name": "太阳", - "emoji": "☀️", - "meaning": "快乐、成功、活力", - "advice": "享受阳光,分享你的快乐。" - }, - { - "name": "世界", - "emoji": "🌍", - "meaning": "完成、成就、圆满", - "advice": "庆祝你的成就,准备迎接新的循环。" - } - ] -} - diff --git a/data/idiom_blacklist.json b/data/idiom_blacklist.json deleted file mode 100644 index 6faa731..0000000 --- a/data/idiom_blacklist.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "blacklist": [], - "description": "成语接龙游戏全局黑名单,被拒绝的词语将永久不可使用" -} - diff --git a/data/quiz.json b/data/quiz.json deleted file mode 100644 index 16bfaeb..0000000 --- a/data/quiz.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "questions": [ - { - "id": 1, - "question": "Python之父是谁?", - "answer": "Guido van Rossum", - "keywords": ["Guido", "吉多", "van Rossum"], - "hint": "荷兰程序员,创建了Python语言", - "category": "编程" - }, - { - "id": 2, - "question": "世界上最高的山峰是什么?", - "answer": "珠穆朗玛峰", - "keywords": ["珠穆朗玛", "珠峰", "Everest", "Mt. Everest"], - "hint": "位于喜马拉雅山脉", - "category": "地理" - }, - { - "id": 3, - "question": "一年有多少天?", - "answer": "365", - "keywords": ["365", "三百六十五"], - "hint": "平年的天数", - "category": "常识" - }, - { - "id": 4, - "question": "中国的首都是哪个城市?", - "answer": "北京", - "keywords": ["北京", "Beijing"], - "hint": "位于华北地区", - "category": "地理" - }, - { - "id": 5, - "question": "光速是多少?", - "answer": "300000", - "keywords": ["300000", "30万", "3*10^8", "3e8"], - "hint": "单位:千米/秒,约30万", - "category": "物理" - }, - { - "id": 6, - "question": "世界上最大的海洋是什么?", - "answer": "太平洋", - "keywords": ["太平洋", "Pacific"], - "hint": "占地球表面积约46%", - "category": "地理" - }, - { - "id": 7, - "question": "一个字节(Byte)等于多少位(bit)?", - "answer": "8", - "keywords": ["8", "八", "8bit"], - "hint": "计算机基础知识", - "category": "计算机" - }, - { - "id": 8, - "question": "人类的正常体温约是多少摄氏度?", - "answer": "37", - "keywords": ["37", "三十七", "36.5", "37度"], - "hint": "36-37度之间", - "category": "生物" - }, - { - "id": 9, - "question": "HTTP协议默认使用哪个端口?", - "answer": "80", - "keywords": ["80", "八十"], - "hint": "HTTPS使用443", - "category": "计算机" - }, - { - "id": 10, - "question": "一个小时有多少分钟?", - "answer": "60", - "keywords": ["60", "六十"], - "hint": "基础时间单位", - "category": "常识" - }, - { - "id": 11, - "question": "太阳系中最大的行星是什么?", - "answer": "木星", - "keywords": ["木星", "Jupiter"], - "hint": "体积和质量都是最大的", - "category": "天文" - }, - { - "id": 12, - "question": "二进制中10等于十进制的多少?", - "answer": "2", - "keywords": ["2", "二", "两"], - "hint": "1*2^1 + 0*2^0", - "category": "数学" - }, - { - "id": 13, - "question": "中国有多少个省级行政区?", - "answer": "34", - "keywords": ["34", "三十四"], - "hint": "23个省+5个自治区+4个直辖市+2个特别行政区", - "category": "地理" - }, - { - "id": 14, - "question": "圆周率π约等于多少?(保留两位小数)", - "answer": "3.14", - "keywords": ["3.14", "3.1415", "3.14159"], - "hint": "圆的周长与直径的比值", - "category": "数学" - }, - { - "id": 15, - "question": "世界上使用人数最多的语言是什么?", - "answer": "中文", - "keywords": ["中文", "汉语", "Chinese", "普通话"], - "hint": "中国的官方语言", - "category": "语言" - } - ] -} - diff --git a/games/base.py b/games/base.py index 0bcfaae..fd3e4ad 100644 --- a/games/base.py +++ b/games/base.py @@ -89,7 +89,6 @@ def get_help_message() -> str: - `.签到` - 每日签到 - `.打卡` - 每日签到 - `.points leaderboard` - 积分排行榜 -- `.points records` - 积分记录 ### ⚗️ 炼金系统 - `.alchemy` - 消耗10积分进行炼金