aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anubhav1603 <[email protected]>2020-09-04 14:55:11 +0530
committerGravatar Anubhav1603 <[email protected]>2020-09-04 14:55:11 +0530
commit7c60922b689f07c4a07872e074f590f23ed77776 (patch)
tree433cef77e81ffe8353ff0d40d8a83980aeae48c0
parentadded period in line 43 to solve D415 (diff)
added value error exception
-rw-r--r--bot/exts/evergreen/wikipedia.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/bot/exts/evergreen/wikipedia.py b/bot/exts/evergreen/wikipedia.py
index 36600c56..24360d28 100644
--- a/bot/exts/evergreen/wikipedia.py
+++ b/bot/exts/evergreen/wikipedia.py
@@ -1,9 +1,9 @@
import asyncio
import datetime
import logging
-import discord
-from typing import Optional
+from typing import Optional
+from discord import Color, Embed
from discord.ext import commands
log = logging.getLogger(__name__)
@@ -35,7 +35,7 @@ class WikipediaCog(commands.Cog):
pass
else:
page.append(a["title"])
- log.info("hit a 'may refer to' page, taking result 2 (index 1)")
+ log.info("appening titles")
return page
@commands.command(name="wikipedia", aliases=["wiki"])
@@ -60,11 +60,11 @@ class WikipediaCog(commands.Cog):
async with ctx.typing():
for index, (a, j) in enumerate(zip(title, final), start=1):
s = s + f'`{index}` [{a}]({WIKIPEDIA_URL.format(title=j)})\n'
- embed = discord.Embed(colour=discord.Color.blue(), title=f"Wikipedia results for `{search}`", description=s)
+ embed = Embed(colour=Color.blue(), title=f"Wikipedia results for `{search}`", description=s)
embed.timestamp = datetime.datetime.utcnow()
await ctx.send(embed=embed)
- embed = discord.Embed(colour=discord.Color.green(), description="Enter number to choose")
+ embed = Embed(colour=Color.green(), description="Enter number to choose")
msg = await ctx.send(embed=embed)
try:
@@ -72,9 +72,12 @@ class WikipediaCog(commands.Cog):
await ctx.send(WIKIPEDIA_URL.format(title=final[int(user.content) - 1]))
except asyncio.TimeoutError:
- embed = discord.Embed(colour=discord.Color.red(), description=f"Time's up {ctx.author.mention}")
+ embed = Embed(colour=Color.red(), description=f"Time's up {ctx.author.mention}")
await msg.edit(embed=embed)
+ except ValueError:
+ await ctx.send("I am sorry but that isn't int value")
+
def setup(bot: commands.Bot) -> None:
"""Uptime Cog load."""