random
This commit is contained in:
parent
eabaa99471
commit
47b349322b
12
wikibot.py
12
wikibot.py
@ -63,4 +63,16 @@ async def search(ctx, search: Option(str, description = "What do you want to get
|
||||
|
||||
|
||||
|
||||
@bot.slash_command(guild_ids=g_ids, name = "random", description="Returns a random Wikipedia article")
|
||||
async def search(ctx):
|
||||
await ctx.channel.trigger_typing() # shows that bot is typing
|
||||
ran_article = wikipedia.random().replace(" ", "_").replace(" ", "_")
|
||||
|
||||
try:
|
||||
await ctx.respond(f"https://en.wikipedia.org/wiki/{ran_article}")
|
||||
except:
|
||||
await ctx.send(f"https://en.wikipedia.org/wiki/{ran_article}")
|
||||
|
||||
|
||||
|
||||
bot.run("MTMyNTk1Mzg4OTcyNzQxNDM0Mw.G2Tgo0.2OhbgaVYhys0BhxJMVgGDnG0W5qvxH-soJML3M")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user