Adding twitter function for maximum shit posting

This commit is contained in:
Luke Robles 2022-05-27 09:16:42 -07:00
parent 5fe8bf4acb
commit bc11cda4fe
3 changed files with 38 additions and 3 deletions

View File

@ -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:

View File

@ -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'><hr size=0 style='border-color:grey;opacity:.5;'><div><p>"
)[1].split(" </p>")[0]

View File

@ -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",