fix(bot.py, dota.py): 修复 opendota 接口返回时间太长导致 discord 报错的问题;修改 Match.party_size 为 nullable
修复 opendota 接口返回时间太长导致 discord 报错的问题;修改 Match.party_size 为 nullable Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
parent
a8825db196
commit
0f4f29332c
@ -42,6 +42,7 @@ async def send_message(channel):
|
|||||||
|
|
||||||
@bot.command(description="获取最近战绩", name='recent_matches') # this decorator makes a slash command
|
@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"
|
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}")
|
logger.info(f"get_friends_recent_matches {name} {match_count}")
|
||||||
friends = dota.Friend.filter(name=name)
|
friends = dota.Friend.filter(name=name)
|
||||||
match_count = int(match_count)
|
match_count = int(match_count)
|
||||||
|
|||||||
2
dota.py
2
dota.py
@ -49,7 +49,7 @@ class Match(BaseModel):
|
|||||||
start_time = peewee.DateTimeField()
|
start_time = peewee.DateTimeField()
|
||||||
duration = peewee.IntegerField()
|
duration = peewee.IntegerField()
|
||||||
radiant_win = peewee.BooleanField()
|
radiant_win = peewee.BooleanField()
|
||||||
party_size = peewee.IntegerField()
|
party_size = peewee.IntegerField(null=True)
|
||||||
|
|
||||||
def serialize_match(self):
|
def serialize_match(self):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user