This commit is contained in:
Abigail Gold 2019-12-10 23:48:56 -05:00
parent 25ea169bf1
commit b980c8e2fa
No known key found for this signature in database
GPG Key ID: CF88335E873C3FB4
2 changed files with 28 additions and 36 deletions

View File

@ -46,40 +46,34 @@ class LookupCog(commands.Cog):
noMatch = True noMatch = True
queryMatch = None queryMatch = None
query = query.upper() query = query.upper()
if query != 'LAST_UPDATED': embed = discord.Embed(title=f'DXCC Info for {query} not found',
embed = discord.Embed(title=f'DXCC Info for {query}', timestamp=datetime.utcnow())
timestamp=datetime.utcnow()) embed.set_footer(text=f'{ctx.author.name}',
embed.set_footer(text=f'{ctx.author.name} | Last Updated: {self.CTY.formatted_version}', icon_url=str(ctx.author.avatar_url))
icon_url=str(ctx.author.avatar_url)) embed.description = f'*Last Updated: {self.CTY.formatted_version}*'
embed.description = f'Prefix {query} not found' embed.colour = cmn.colours.bad
embed.colour = cmn.colours.bad while noMatch:
while noMatch: if query in self.CTY.keys():
if query in self.CTY.keys(): queryMatch = query
queryMatch = query noMatch = False
else:
query = query[:-1]
if len(query) == 0:
noMatch = False noMatch = False
else: if queryMatch is not None:
query = query[:-1] data = self.CTY[queryMatch]
if len(query) == 0: embed.add_field(name="Entity",
noMatch = False value=data['entity'])\
if queryMatch is not None: .add_field(name="CQ Zone",
data = self.CTY[queryMatch] value=data['cq'])\
embed = embed.add_field(name="Entity", .add_field(name="ITU Zone",
value=data['entity'])\ value=data['itu'])\
.add_field(name="CQ Zone", .add_field(name="Continent",
value=data['cq'])\ value=data['continent'])\
.add_field(name="ITU Zone", .add_field(name="Time Zone",
value=data['itu'])\ value=f'+{data["tz"]}' if data['tz'] > 0 else str(data['tz']))
.add_field(name="Continent", embed.title = f'DXCC Info for {query}'
value=data['continent'])\ embed.colour = cmn.colours.good
.add_field(name="Time Zone",
value=f'+{data["tz"]}' if data['tz'] > 0 else str(data['tz']))
embed.description = ''
embed.colour = cmn.colours.good
else:
result = f'CTY.DAT last updated on {self.CTY.formatted_version}'
embed = discord.Embed(title=result, colour=cmn.colours.neutral)
embed.set_footer(text=f'{ctx.author.name}',
icon_url=str(ctx.author.avatar_url))
await ctx.send(embed=embed) await ctx.send(embed=embed)
@tasks.loop(hours=24) @tasks.loop(hours=24)

View File

@ -1,6 +1,4 @@
discord.py discord.py
feedparser
requests
ctyparser ctyparser
beautifulsoup4 beautifulsoup4
lxml lxml