async def image(self, ctx: commands.Context, *, query=None): self.query = query self.our_embed_session = discord.Embed() self.our_embed_session.title = f"**Search results for {self.query}**" self.our_embed_session.description = ( f"Requested by: {ctx.message.author.display_name}") if self.query is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to give me a query!").get_error_embed()) return try: if ctx.channel.is_nsfw() is False: self.array_of_images = conf.get_images(self.query, "high") else: self.array_of_images = conf.get_images(self.query, "off") except NoResults: await ctx.send(embed=errorhandler.BotAlert( "error", f"I couldn't find anything for {self.query}"). get_error_embed()) return await ImagePaginator.paginate( pages=self.array_of_images, ctx=ctx, embed=self.our_embed_session, bot=self.bot, )
async def on_command_error(ctx: commands.Context, error: commands.errors): if isinstance(error, commands.CommandOnCooldown): await (await ctx.send(embed=errorhandler.BotAlert( "warn", f"This command is in a {error.retry_after :.2f} cooldown, try again later", ).get_error_embed())).delete(delay=5) await asyncio.sleep(6) if isinstance(error, commands.CommandNotFound): await (await ctx.send(embed=errorhandler.BotAlert( "warn", "That command isn't in my command list!").get_error_embed() )).delete(delay=5) await asyncio.sleep(6) if isinstance(error, errorhandler.CommandRedditBreaker): await (await ctx.send(embed=errorhandler.BotAlert( "error", "There was an error fetching that Subreddit! Are you sute it exists and it isn't banned from Reddit?", ).get_error_embed())).delete(delay=5) await asyncio.sleep(6) if isinstance(error, commands.CommandInvokeError): await (await ctx.send(embed=errorhandler.BotAlert( type="error", why="There was an error running this command. Internal bot error!.", ).get_error_embed())).delete(delay=5) await asyncio.sleep(6) raise error
async def brew(self, ctx: commands.Context, *, formuale=None): if formuale is None: await ctx.send(embed=errorhandler.BotAlert( "error", "You need to give me a formulae.").get_error_embed()) return try: self.formuale_session = brew.HomebrewInteracter( formuale).get_target_formula() except brew.NoHomebrewFormuale: await ctx.send(embed=errorhandler.BotAlert( "error", f"Couldn't find anything for that query {formuale}"). get_error_embed()) return await ctx.send(embed=embeds.HomebrewEmbed( self.formuale_session).get_embed_message())
async def redditpost(self, ctx: commands.Context, *, subreddit=None): """Description: Grabs a post from a desired subreddit, provided by the user, if the post is NSFW it will only display on NSFw channels\nArguments: `1`""" self.forbidden = ["c**k", "ass", "sex", "dick", "penis", "pussy"] self.current_subreddit = subreddit if self.current_subreddit is None: await ctx.send( embed=errorhandler.BotAlert("warn", "Give me a Subreddit.").get_error_embed() ) raise errorhandler.CommandBreaker async with ctx.typing(): try: self.reddit_post = conf.get_reddit_post(self.current_subreddit) except NotFound: raise errorhandler.CommandRedditBreaker(404) except Forbidden: raise errorhandler.CommandRedditBreaker(403) if (self.reddit_post.is_nsfw) and (ctx.channel.is_nsfw() is False): raise errorhandler.CommandRedditBreaker(100) self.string_test_result = any( element in self.current_subreddit for element in self.forbidden ) if self.string_test_result and (ctx.channel.is_nsfw() is False): raise errorhandler.CommandRedditBreaker(0) embed_message = embeds.RedditEmbedMessage( self.reddit_post, "post", ).get_embed_message() await ctx.send(embed=embed_message)
async def ask(self, ctx, *, question=None): """Description: Gives an answer to a question asked by a user. Similar to 8ball.\nArguments: `1`""" if question is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to ask something").get_error_embed()) else: ask_answer = random_operations.get_8_ball() await ctx.send(f"{ctx.author.mention}, {ask_answer}")
async def lewdneko(self, ctx): """Description: Grabs a hentai image or gif and it gets displayed.\nArguments: `None`""" async with ctx.typing(): if ctx.channel.is_nsfw(): await ctx.send(nekoimg.get_neko_nsfw()) else: await ctx.send(embed=errorhandler.BotAlert( 2, "Can't post NSFW in non-NSFW channels.").get_error_embed())
async def lewdfemboy(self, ctx): """Description: Grabs an image from r/femboys and shows it to the user.\nArguments: `None`""" if ctx.channel.is_nsfw(): self.reddit_post = conf.get_reddit_post("femboys") await ctx.send(self.reddit_post.image) else: await ctx.send(embed=errorhandler.BotAlert( "error", "Can't post NSFW in non-NSFW channels.").get_error_embed())
async def hug(self, ctx, member: discord.User = None): """Description: Displays a gif of two anime characters hugging, with a title formatted as User A is hugging User B\nArguments: `1`""" self.current_member = member if self.current_member is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to provide an user.").get_error_embed()) else: if ctx.message.author == self.current_member: await ctx.send(embed=errorhandler.BotAlert( 1, "You can't hug yourself").get_error_embed()) return neko_action = embeds.NekoEmbed( self.our_neko_actions.neko_hug(), ctx.author.name, str(member.name), "hug", ).get_embed_message() await ctx.send(embed=neko_action)
async def fourchanpost(self, ctx, *, target_board=None): """Description: Grabs a random post from a user provided board and posts it on the chat, prevents NSFW\nArguments: `None`""" self.target_board = target_board if self.target_board is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to provide a board.").get_error_embed()) return self.four_chan_post = config.get_fourchan_post(self.target_board) print(self.four_chan_post) if (self.four_chan_post.submission_is_nsfw is False) and (ctx.channel.is_nsfw() is False): await ctx.send(embed=errorhandler.BotAlert( "warn", "Can't display NSFW content in non-NSFW channels."). get_error_embed()) return self.embed_message = embeds.FourChanEmbed( self.four_chan_post).get_embed_message() await ctx.send(embed=self.embed_message)
async def lmgtfy(self, ctx, *, our_terms=None): """Description: Generates an URL to lmgtfy containing your desired search terms\nArguments: `1`""" if our_terms is None: await ctx.send( errorhandler.BotAlert( "warn", "You need to provide a query.").get_error_embed()) else: self.lmgtfy_list = our_terms.split() await ctx.send(Lmgtfy(self.lmgtfy_list).get_url())
async def github(self, ctx: commands.Context, *, repository=None): self.repository = repository if self.repository is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to give me a repository!").get_error_embed()) return try: self.github_session = GitHub(self.repository) except GitHubRepositoryError: await ctx.send(embed=errorhandler.BotAlert( "error", f"Had an error getting that repository. Are you sure {self.repository} exists?", ).get_error_embed()) return async with ctx.typing(): self.our_github_respostory = self.github_session.get_github_repo() self.our_embed = embeds.GitHubEmbed(discord.Color.greyple(), self.our_github_respostory) await ctx.send(embed=self.our_embed.get_embed_message())
async def wikipedia(self, ctx, *, query=None): """Description: Displays information about a Wikipedia article in channel.\nArguments: `1`""" self.query = query if self.query is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to give me a query!").get_error_embed()) return try: self.our_wikipedia_message = Wikipedia( self.query).get_wikipedia_article() except NoArticlesOrNotFound: await ctx.send(embed=errorhandler.BotAlert( "error", f"I couldn't find anything for {self.query}"). get_error_embed()) return self.embed_message = embeds.WikipediaEmbed(discord.Color.blue(), self.our_wikipedia_message) await ctx.send(embed=self.embed_message.get_embed_message())
async def jb(self, ctx: commands.Context, *, package=None): if package is None: await ctx.send(embed=errorhandler.BotAlert( "error", "You need to give me a package to search!").get_error_embed()) return self.package_response = await JailbreakPackageInteractor( package).get_packages() for p in self.package_response: await ctx.send("Here you go f****t: " + str(p))
async def poll(self, ctx, *, desired_questions: str = None): if desired_questions is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "What do you want a poll about? Syntax: Question, options, separated, by, commas", )) return self.split_questions = desired_questions.split(",") self.question = self.split_questions[0] self.split_questions.pop(0) try: self.poll_verify = poll.PollHelper( self.split_questions).verify_poll() except poll.PollException: await ctx.send(embed=errorhandler.BotAlert( "error", "Limit exeded").get_error_embed()) return self.multiple_choice = BotMultipleChoice(ctx, self.split_questions, self.question) await self.multiple_choice.run()
async def clone(self, ctx, member: discord.User = None, *, message=None): """Description: Replicates what an user says, if no user is provided it will clone the message author\nArguments: `1 up to 2`""" if member is None and message is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to provide an user and a message."). get_error_embed()) return if "@" in message or "<" in message or "&" in message: await ctx.send(embed=errorhandler.BotAlert( "warn", "I will not ping another user/a role/or everyone"). get_error_embed()) return self.target_to_clone = member self.profile_picture = requests.get( self.target_to_clone.avatar_url_as(format="png", size=256)).content self.hook = await ctx.channel.create_webhook( name=self.target_to_clone.display_name, avatar=self.profile_picture) await self.hook.send(message) await self.hook.delete()
async def owofy(self, ctx, *, our_input=None): """Description: Owofies sewected input UwU\nArguments: `1`""" if our_input is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to give a message to owofy").get_error_embed()) return self.string_check_session = stringchecker.StringChecker(our_input) if self.string_check_session.is_unicode() is False: await ctx.send(embed=errorhandler.BotAlert( "warn", "Nice try on bypassing. However Cheems doesn't accept unicode." ).get_error_embed()) return if self.string_check_session.contains_racism(): await ctx.send(embed=errorhandler.BotAlert( "warn", "Cheems does not repeat or talks to racists."). get_error_embed()) return self.owofied_input = nekoimg.owo_text(our_input) await ctx.send(self.owofied_input)
async def urban(self, ctx, *, term=None): self.term = term self.our_embed_session = discord.Embed(color=0x3E9CBF) if self.term is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to provide a term!").get_error_embed()) return try: self.definitions = UrbanDictionary( self.term).get_urban_definitions() except UrbanDictionaryError: self.pure_term = discord.utils.escape_mentions(self.term) await ctx.send(embed=errorhandler.BotAlert( "error", f"Couldn't find anything for that query {self.pure_term}"). get_error_embed()) return await UrbanPagintor.paginate( definitions=self.definitions, ctx=ctx, embed=self.our_embed_session, bot=self.bot, )
async def ischad(self, ctx, member: discord.User = None): """Description: Tells you if an user is a Chad or a Beta based on luck.\nArguments: `1`""" self.current_member = member if self.current_member is None: await ctx.send(embed=errorhandler.BotAlert( "warn", "You need to provide an user.").get_error_embed()) else: self.chad_virgin_prob = random.randint(0, 100) if self.chad_virgin_prob >= 50: await ctx.send( f"{member.mention} is a chad! <:chad:741875439940665365>") else: await ctx.send( f"{member.mention} is a beta! <:virgin:741907301627199499>" )
async def help(self, ctx, *cog): """Displays the help message what else""" try: if not cog: our_help_embed = discord.Embed( title="🍔 Cheemsburbger help", description="Cheems advanced technologies", color=discord.Color.green(), ) our_help_embed.set_thumbnail( url= "https://media.discordapp.net/attachments/743930523440775253/744976899037593710/3dgifmaker71.gif" ) our_help_embed.set_footer( text= "Cheemsburguer is free software. And it is licensed under the WTFPL license. Copyright Diego Magdaleno 2020 et al." ) cogs_desc = "" for each_cog in self.bot.cogs: if vars(self.bot.cogs[each_cog]).get("hidden") is not True: cogs_desc += ( f"**{each_cog}**\n• {self.bot.cogs[each_cog].__doc__}\n" ) our_help_embed.add_field( name="Categories", value=cogs_desc[0:len(cogs_desc) - 1], inline=True, ) commands_desc = "" for command in self.bot.walk_commands(): if not command.cog_name and not command.hidden: commands_desc += f"{command.name} - {command.help}\n" if commands_desc != "": our_help_embed.add_field( name="Uncategorized commands", value=commands_desc[0:len(commands_desc) - 1], inline=False, ) await ctx.send(embed=our_help_embed) else: if len(cog) > 1: our_help_embed = discord.Embed( title="Error!", description="Too many cogs", color=discord.Color.red(), ) await ctx.send(embed=our_help_embed) else: found = False for each_cog in self.bot.cogs: index_target = [ x.lower() for x in self.bot.cogs.keys() ].index(cog[0].lower()) to_lower = each_cog.lower() for each in cog: if to_lower == each.lower(): target = list( self.bot.cogs.keys())[index_target] our_help_embed = discord.Embed( title=target + " Command Listing", description=self.bot.cogs[target].__doc__, ) for individual_cog in self.bot.get_cog( target).get_commands(): if not individual_cog.hidden: our_help_embed.add_field( name=individual_cog.name, value=individual_cog.help, inline=False, ) found = True if not found: our_help_embed = discord.Embed( title="Error!", description='Are you sure the command"' + cog[0] + '"Exits?', color=discord.Color.red(), ) else: await ctx.send(embed=our_help_embed) except: await ctx.send(embed=errorhandler.BotAlert( "error", "Excuse me, I can't send embeds.").get_error_embed())