From 0f4f29332cb8fec47274615188de157c051ec95d Mon Sep 17 00:00:00 2001 From: Ching Date: Tue, 3 Oct 2023 22:53:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(bot.py,=20dota.py):=20=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?opendota=20=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=A4=AA=E9=95=BF=E5=AF=BC=E8=87=B4=20discord=20?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20Match.party=5Fsize=20=E4=B8=BA=20nullable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 opendota 接口返回时间太长导致 discord 报错的问题;修改 Match.party_size 为 nullable Signed-off-by: Ching --- discord_bot.py | 1 + dota.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/discord_bot.py b/discord_bot.py index c94c296..355e366 100644 --- a/discord_bot.py +++ b/discord_bot.py @@ -42,6 +42,7 @@ async def send_message(channel): @bot.command(description="获取最近战绩", name='recent_matches') # this decorator makes a slash command async def get_friends_recent_matches(ctx, name, match_count=5): # a slash command will be created with the name "ping" + await ctx.defer() logger.info(f"get_friends_recent_matches {name} {match_count}") friends = dota.Friend.filter(name=name) match_count = int(match_count) diff --git a/dota.py b/dota.py index 5d48887..9795472 100644 --- a/dota.py +++ b/dota.py @@ -49,7 +49,7 @@ class Match(BaseModel): start_time = peewee.DateTimeField() duration = peewee.IntegerField() radiant_win = peewee.BooleanField() - party_size = peewee.IntegerField() + party_size = peewee.IntegerField(null=True) def serialize_match(self): try: