From bc11cda4fe71eea7f328a9555a2ab25255ee0bae Mon Sep 17 00:00:00 2001 From: Luke Robles <98352913+lrobles-iterable@users.noreply.github.com> Date: Fri, 27 May 2022 09:16:42 -0700 Subject: [PATCH] Adding twitter function for maximum shit posting --- app/cogs/cheeky_functions.py | 26 +++++++++++++++++++++++--- app/core_utils.py | 10 ++++++++++ app/help_methods.py | 5 +++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/app/cogs/cheeky_functions.py b/app/cogs/cheeky_functions.py index 5db2635d..eccf70ef 100644 --- a/app/cogs/cheeky_functions.py +++ b/app/cogs/cheeky_functions.py @@ -2,6 +2,7 @@ from discord.ext import commands import core_utils import discord import random +import requests class Cheeky(commands.Cog): @@ -26,7 +27,7 @@ class Cheeky(commands.Cog): with open("/app/simp.jpg", "wb") as f: f.write(response.content) await ctx.message.delete() - await ctx.reply(file=discord.File("/app/simp.jpg")) + await ctx.send(file=discord.File("/app/simp.jpg")) @commands.command(name="horny") async def horny(self, ctx: commands.Context): @@ -39,7 +40,7 @@ class Cheeky(commands.Cog): with open("/app/horny.jpg", "wb") as f: f.write(response.content) await ctx.message.delete() - await ctx.reply(file=discord.File("/app/horny.jpg")) + await ctx.send(file=discord.File("/app/horny.jpg")) @commands.command(name="wasted") async def wasted(self, ctx: commands.Context): @@ -52,7 +53,7 @@ class Cheeky(commands.Cog): with open("/app/wasted.jpg", "wb") as f: f.write(response.content) await ctx.message.delete() - await ctx.reply(file=discord.File("/app/wasted.jpg")) + await ctx.send(file=discord.File("/app/wasted.jpg")) @commands.command(name="verify") async def verify(self, ctx: commands.Context): @@ -176,6 +177,25 @@ class Cheeky(commands.Cog): result = river_stats.get_stats() await ctx.reply(embed=result) + @commands.command(name="twitter") + async def twitter(self, ctx: commands.Context, message_id): + + message = await ctx.channel.fetch_message(message_id) + author_avatar = message.author.avatar + response = requests.get( + "https://some-random-api.ml/canvas/tweet/?avatar=%s&username=%s&displayname=%s&comment=%s" + % ( + author_avatar, + core_utils.gen_username()[:14], + message.author.display_name, + message.content, + ) + ) + with open("/tmp/tweet.jpg", "wb") as f: + f.write(response.content) + await ctx.message.delete() + await ctx.send(file=discord.File("/tmp/tweet.jpg")) + @commands.command(name="sus") async def sus(self, ctx: commands.Context): if random.randint(0, 200) == 0: diff --git a/app/core_utils.py b/app/core_utils.py index aeca3938..b3ee5b5c 100755 --- a/app/core_utils.py +++ b/app/core_utils.py @@ -54,3 +54,13 @@ def generate_embed( embed.set_author(name=author_name, icon_url=author_image) return embed + + +def gen_username(): + url = "https://generatorfun.com/code/model/generatorcontent.php?recordtable=generator&recordkey=960&gen=Y&itemnumber=1&randomoption=undefined&genimage=Yes&geneditor=No&nsfw=undefined&keyword=undefined&searchfilter=&searchfilterexclude=&tone=Normal&prefix=None&randomai=undefined" + + response = requests.get(url).text + # This is ugly as fuck but i didnt want to break out beautiful soup + return response.split( + "div id='gencont'>
" + )[1].split("
")[0] diff --git a/app/help_methods.py b/app/help_methods.py index 11f5910f..fbdb10aa 100755 --- a/app/help_methods.py +++ b/app/help_methods.py @@ -181,6 +181,11 @@ def get_help_message(method): "\nUsage: !tts who watches the watchmen?", "\nTo list all languages, you can type `!tts langs`", ], + "twitter": [ + "Uploads an image of a fake tweet with the message IDs content.\nThis is advanced shitposting", + "\nTo use this, copy the ID of a message in your channel, and invoke twitter with the message ID as an argument\n" + "\nUsage: !twitter 979779350750724097", + ], "youtube": [ "Searches youtube for the query string and returns the first result", "\nUsage: !youtube sick bmx tricks",