Skip to content

Commit b3b9a56

Browse files
committed
Add subcommands help and showfic_random
1 parent ed5dbf4 commit b3b9a56

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

ffpicker/ffpicker.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
import discord
33
import re
44
import requests
5+
import time
56

67
from bs4 import BeautifulSoup
8+
from random import randint
79
from redbot.core import checks, commands, Config
810
from redbot.core.utils.menus import menu, DEFAULT_CONTROLS
911

1012

11-
__version__ = "1.0.1"
13+
__version__ = "1.1"
1214

1315
BaseCog = getattr(commands, "Cog", object)
1416

@@ -60,6 +62,17 @@ async def picker(self, ctx, page_num: int = 1):
6062

6163
await menu(ctx, embeds, DEFAULT_CONTROLS, page=page_num - 1)
6264

65+
@commands.guild_only()
66+
@picker.command()
67+
async def help(self, ctx):
68+
"""
69+
Show FFPicker help manual
70+
"""
71+
cmd = self.bot.get_command("help")
72+
prefix = await self.bot.db.guild(ctx.guild).prefix()
73+
ctx.message.content = prefix + cmd.name + " " + ctx.command.full_parent_name
74+
await self.bot.process_commands(ctx.message)
75+
6376
@commands.guild_only()
6477
@picker.command()
6578
@checks.is_owner()
@@ -283,3 +296,13 @@ async def showfic(self, ctx, num: int):
283296
msg = f"Showing story #{idx+1} added by {user}."
284297
em = self.format_embed(metadata)
285298
await ctx.send(msg, embed=em)
299+
300+
@commands.guild_only()
301+
@picker.command(name="random")
302+
async def showfic_random(self, ctx):
303+
"""
304+
Show a random story from the collection
305+
"""
306+
stories = await self.config.guild(ctx.guild).stories()
307+
cmd = self.bot.get_command("ffpicker show")
308+
await ctx.invoke(cmd, num=randint(1, len(stories)))

0 commit comments

Comments
 (0)