mirror of
https://github.com/miaowware/qrm2.git
synced 2025-09-10 08:27:48 -04:00
fix task start issue
This commit is contained in:
parent
1b734a5151
commit
dbdb512b29
@ -14,6 +14,7 @@ import json
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from util import cty_json
|
from util import cty_json
|
||||||
|
|
||||||
|
|
||||||
class LookupCog(commands.Cog):
|
class LookupCog(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
@ -23,9 +24,9 @@ class LookupCog(commands.Cog):
|
|||||||
self.up_cty_first_run = True
|
self.up_cty_first_run = True
|
||||||
|
|
||||||
@commands.command(name="ae7q", aliases=['ae'])
|
@commands.command(name="ae7q", aliases=['ae'])
|
||||||
async def _ae7q_lookup(self, ctx, call: str):
|
async def _ae7q_lookup(self, ctx, c: str):
|
||||||
'''Links to info about a callsign from AE7Q.'''
|
'''Links to info about a callsign from AE7Q.'''
|
||||||
await ctx.send(f'http://ae7q.com/query/data/CallHistory.php?CALL={call}')
|
await ctx.send(f'http://ae7q.com/query/data/CallHistory.php?CALL={c}')
|
||||||
|
|
||||||
@commands.command(name="qrz")
|
@commands.command(name="qrz")
|
||||||
async def _qrz_lookup(self, ctx, call: str):
|
async def _qrz_lookup(self, ctx, call: str):
|
||||||
@ -38,9 +39,15 @@ class LookupCog(commands.Cog):
|
|||||||
Usage: `?sat sat_name grid1 grid2`'''
|
Usage: `?sat sat_name grid1 grid2`'''
|
||||||
now = datetime.utcnow().strftime('%Y-%m-%d%%20%H:%M')
|
now = datetime.utcnow().strftime('%Y-%m-%d%%20%H:%M')
|
||||||
if grid2 is None or grid2 == '':
|
if grid2 is None or grid2 == '':
|
||||||
await ctx.send(f'http://www.satmatch.com/satellite/{sat}/obs1/{grid1}?search_start_time={now}&duration_hrs=24')
|
await ctx.send(
|
||||||
|
f'http://www.satmatch.com/satellite/{sat}/obs1/{grid1}' +
|
||||||
|
f'?search_start_time={now}&duration_hrs=24'
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
await ctx.send(f'http://www.satmatch.com/satellite/{sat}/obs1/{grid1}/obs2/{grid2}?search_start_time={now}&duration_hrs=24')
|
await ctx.send(
|
||||||
|
f'http://www.satmatch.com/satellite/{sat}/obs1/{grid1}' +
|
||||||
|
f'/obs2/{grid2}?search_start_time={now}&duration_hrs=24'
|
||||||
|
)
|
||||||
|
|
||||||
@commands.command(name="dxcc", aliases=['dx'])
|
@commands.command(name="dxcc", aliases=['dx'])
|
||||||
async def _dxcc_lookup(self, ctx, q: str):
|
async def _dxcc_lookup(self, ctx, q: str):
|
||||||
@ -64,11 +71,14 @@ class LookupCog(commands.Cog):
|
|||||||
noMatch = False
|
noMatch = False
|
||||||
if qMatch is not None:
|
if qMatch is not None:
|
||||||
d = self.CTY[qMatch]
|
d = self.CTY[qMatch]
|
||||||
prefix = qMatch
|
embed = embed.add_field(name="Entity",
|
||||||
embed = embed.add_field(name="Entity", value=d['entity'])
|
value=d['entity'])
|
||||||
embed = embed.add_field(name="CQ Zone", value=d['cq'])
|
embed = embed.add_field(name="CQ Zone",
|
||||||
embed = embed.add_field(name="ITU Zone", value=d['itu'])
|
value=d['cq'])
|
||||||
embed = embed.add_field(name="Continent", value=d['continent'])
|
embed = embed.add_field(name="ITU Zone",
|
||||||
|
value=d['itu'])
|
||||||
|
embed = embed.add_field(name="Continent",
|
||||||
|
value=d['continent'])
|
||||||
tz = d['tz']
|
tz = d['tz']
|
||||||
if tz > 0:
|
if tz > 0:
|
||||||
tz = '+' + str(tz)
|
tz = '+' + str(tz)
|
||||||
@ -76,11 +86,11 @@ class LookupCog(commands.Cog):
|
|||||||
embed.description = ''
|
embed.description = ''
|
||||||
embed.colour = self.gs.colours.good
|
embed.colour = self.gs.colours.good
|
||||||
else:
|
else:
|
||||||
updatedDate = self.CTY['last_updated'][0:4] + '-'
|
updatedDate = self.CTY['last_updated'][0:4] + '-'
|
||||||
updatedDate += self.CTY['last_updated'][4:6] + '-'
|
updatedDate += self.CTY['last_updated'][4:6] + '-'
|
||||||
updatedDate += self.CTY['last_updated'][6:8]
|
updatedDate += self.CTY['last_updated'][6:8]
|
||||||
res = f'CTY.DAT last updated on {updatedDate}'
|
r = f'CTY.DAT last updated on {updatedDate}'
|
||||||
embed = discord.Embed(title=res, colour=self.gs.colours.neutral)
|
embed = discord.Embed(title=r, colour=self.gs.colours.neutral)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@tasks.loop(hours=24)
|
@tasks.loop(hours=24)
|
||||||
@ -94,9 +104,10 @@ class LookupCog(commands.Cog):
|
|||||||
self.CTY_list = list(self.CTY.keys())
|
self.CTY_list = list(self.CTY.keys())
|
||||||
self.CTY_list.sort()
|
self.CTY_list.sort()
|
||||||
self.CTY_list.sort(key=len, reverse=True)
|
self.CTY_list.sort(key=len, reverse=True)
|
||||||
up_cty_first_run = False
|
self.up_cty_first_run = False
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(LookupCog(bot))
|
lookupcog = LookupCog(bot)
|
||||||
bot.get_cog("LookupCog")._update_cty.start()
|
bot.add_cog(lookupcog)
|
||||||
|
lookupcog._update_cty.start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user