async def sub(self, ctx): """Launches a tutorial session for the subscription feature. Kyogre will create a private channel and initiate a conversation that walks you through the various commands that are enabled on the current server.""" newbie = ctx.author guild = ctx.guild # get channel overwrites ows = self.get_overwrites(guild, newbie) # create tutorial channel name = utils.sanitize_channel_name(newbie.display_name + "-tutorial") ctx.tutorial_channel = await guild.create_text_channel(name, overwrites=ows) await ctx.message.delete() await ctx.send(("I've created a private tutorial channel for " f"you! Continue in {ctx.tutorial_channel.mention}"), delete_after=20.0) # get tutorial settings cfg = self.bot.guild_dict[guild.id]['configure_dict'] await ctx.tutorial_channel.send( f"Hi {ctx.author.mention}! I'm Kyogre, a Discord helper bot for " "Pokemon Go communities! I created this channel to teach you " "about the want command! You can abandon this tutorial at any time " "and I'll delete this channel after five minutes. " "Let's get started!") try: await self.sub_tutorial(ctx, cfg) await ctx.tutorial_channel.send( f"This concludes the Kyogre tutorial! " "This channel will be deleted in ten seconds.") await asyncio.sleep(10) finally: await ctx.tutorial_channel.delete()
async def tutorial(self, ctx): """Launches an interactive tutorial session for Kyogre. Kyogre will create a private channel and initiate a conversation that walks you through the various commands that are enabled on the current server.""" newbie = ctx.author guild = ctx.guild prefix = ctx.prefix # get channel overwrites ows = self.get_overwrites(guild, newbie) # create tutorial channel name = utils.sanitize_channel_name(newbie.display_name + "-tutorial") ctx.tutorial_channel = await guild.create_text_channel(name, overwrites=ows) await ctx.message.delete() await ctx.send(("I've created a private tutorial channel for " f"you! Continue in {ctx.tutorial_channel.mention}"), delete_after=20.0) # get tutorial settings cfg = self.bot.guild_dict[guild.id]['configure_dict'] enabled = [k for k, v in cfg.items() if v.get('enabled', False)] await ctx.tutorial_channel.send( f"Hi {ctx.author.mention}! I'm Kyogre, a Discord helper bot for " "Pokemon Go communities! I created this channel to teach you all " "about the things I can do to help you on this server! You can " "abandon this tutorial at any time and I'll delete this channel " "after five minutes. Let's get started!") try: # start region tutorial if 'regions' in enabled: completed = await self.region_tutorial(ctx, cfg) if not completed: return # start subscription tutorial if 'subscriptions' in enabled: completed = await self.sub_tutorial(ctx, cfg) if not completed: return # start wild tutorial if 'wild' in enabled: completed = await self.wild_tutorial(ctx, cfg) if not completed: return # start raid if 'raid' in enabled: completed = await self.raid_tutorial(ctx, cfg) if not completed: return # start exraid if 'exraid' in enabled: invitestr = "" if 'invite' in enabled: invitestr = ( "The text channels that are created with this command " f"are read-only until members use the **{prefix}invite** " "command.") await ctx.tutorial_channel.send( f"This server utilizes the **{prefix}exraid** command to " "report EX raids! When you use it, I will send a message " "summarizing the report and create a text channel for " f"coordination. {invitestr}\n" "The report must contain only the location of the EX raid.\n\n" "Due to the longer-term nature of EX raid channels, we won't " "try this command out right now.") # start research if 'research' in enabled: completed = await self.research_tutorial(ctx, cfg) if not completed: return # start team # if 'team' in enabled: # completed = await self.team_tutorial(ctx) # if not completed: # return # finish tutorial await ctx.tutorial_channel.send( f"This concludes the Kyogre tutorial! " "This channel will be deleted in 30 seconds.") await asyncio.sleep(30) finally: await ctx.tutorial_channel.delete()