dragon-bot/app/cogs/cheeky_functions.py

265 lines
10 KiB
Python

from discord.ext import commands
import core_utils
import discord
import random
import requests
class Cheeky(commands.Cog):
def __init__(self, bot):
self.bot: commands.Bot = bot
@commands.command(name="decide")
async def decide(self, ctx: commands.Context):
import decide
await ctx.reply(decide.decide(ctx.message.content))
@commands.command(name="simp")
async def simp(self, ctx: commands.Context):
if len(ctx.message.content.split()) == 1:
return await ctx.send("You must provide a link to an image")
response = requests.get(
"https://some-random-api.ml/canvas/simpcard/?avatar=%s"
% ctx.message.content.split()[-1]
)
with open("/app/simp.jpg", "wb") as f:
f.write(response.content)
await ctx.message.delete()
await ctx.send(file=discord.File("/app/simp.jpg"))
@commands.command(name="horny")
async def horny(self, ctx: commands.Context):
if len(ctx.message.content.split()) == 1:
return await ctx.send("You must provide a link to an image")
response = requests.get(
"https://some-random-api.ml/canvas/horny/?avatar=%s"
% ctx.message.content.split()[-1]
)
with open("/app/horny.jpg", "wb") as f:
f.write(response.content)
await ctx.message.delete()
await ctx.send(file=discord.File("/app/horny.jpg"))
@commands.command(name="wasted")
async def wasted(self, ctx: commands.Context):
if len(ctx.message.content.split()) == 1:
return await ctx.send("You must provide a link to an image")
response = requests.get(
"https://some-random-api.ml/canvas/wasted/?avatar=%s"
% ctx.message.content.split()[-1]
)
with open("/app/wasted.jpg", "wb") as f:
f.write(response.content)
await ctx.message.delete()
await ctx.send(file=discord.File("/app/wasted.jpg"))
@commands.command(name="verify")
async def verify(self, ctx: commands.Context):
message = list(await ctx.message.channel.history(limit=2).flatten())[-1]
emoji = discord.utils.get(ctx.message.guild.emojis, name="verified")
if emoji:
await message.add_reaction(emoji)
@commands.command(name="coom", pass_context=True)
async def coom(self, ctx: commands.Context, id=None):
if ctx.message.author.id != 144986109804412928:
return
message = list(await ctx.message.channel.history(limit=2).flatten())[-1]
if id:
message = await ctx.channel.fetch_message(id)
await ctx.message.delete()
for emoji in await ctx.message.guild.fetch_emojis():
await message.add_reaction(emoji)
@commands.command(name="clap")
async def clap(self, ctx: commands.Context):
content = ctx.message.content.split()[1:]
if len(content) == 1:
content = [char for char in content[0]]
await ctx.send("{}".format(" :clap: ".join(content)))
@commands.command(name="greentext")
async def greentext(self, ctx: commands.Context):
import get_from_reddit
await ctx.reply(
embed=core_utils.generate_embed(
embed_title=">implying this actually happened",
embed_color=discord.Color.green(),
embed_url=get_from_reddit.get_image(
boards=["aigreentext", "greentext", "newgreentexts", "4chan"]
),
)
)
@commands.command(name="roll")
async def roll(
self, ctx: commands.Context, number_of_die, sides, number_to_add=None
):
import dice
sides = sides.split("d")[1]
if "+" in ctx.message.content:
number_to_add = int(ctx.message.content.split("+")[-1])
await ctx.reply(embed=dice.roll(number_of_die, sides, number_to_add))
@commands.command(name="excuse")
async def excuse(self, ctx: commands.Context):
import excuse
await ctx.reply(excuse.get_excuse())
@commands.command(name="meme")
async def meme(self, ctx: commands.Context):
import meme_gen
await ctx.message.delete()
try:
await ctx.send(
embed=core_utils.generate_embed(
embed_url=meme_gen.parse_message(ctx.message.content)
)
)
except discord.errors.HTTPException:
await ctx.send(meme_gen.get_meme_help())
@commands.command(name="define", aliases=["ud"])
async def define(self, ctx: commands.Context):
import define_word
await ctx.send(embed=define_word.get_definition(ctx.message.content))
@commands.command(name="wallpaper")
async def wallpaper(self, ctx: commands.Context):
import wallpaper
async with ctx.message.channel.typing():
await ctx.reply(
embed=core_utils.generate_embed(
embed_url=wallpaper.get_wall(ctx.message.content)
)
)
@commands.command(name="nft")
async def nft(self, ctx: commands.Context):
import nft
result = nft.get_nft()
await ctx.reply(result)
@commands.command(name="8ball")
async def eight_ball(self, ctx: commands.Context):
import eight_ball
result = eight_ball.check_8ball(ctx.message.content)
await ctx.reply(":8ball: %s :8ball:" % result)
@commands.command(name="flows")
async def flows(self, ctx: commands.Context):
import river_stats
result = river_stats.get_stats()
await ctx.reply(embed=result)
@commands.command(name="twitter", aliases=["tweet"])
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[:999],
)
)
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:
await ctx.reply(
"""
```
⠀⠀⠀⠀⠀⢰⡿⠋⠁⠀⠀⠈⠉⠙⠻⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣿⠇⠀⢀⣴⣶⡾⠿⠿⠿⢿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣀⣀⣸⡿⠀⠀⢸⣿⣇⠀⠀⠀⠀⠀⠀⠙⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣾⡟⠛⣿⡇⠀⠀⢸⣿⣿⣷⣤⣤⣤⣤⣶⣶⣿⠇⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀
⢀⣿⠀⢀⣿⡇⠀⠀⠀⠻⢿⣿⣿⣿⣿⣿⠿⣿⡏⠀⠀⠀⠀⢴⣶⣶⣿⣿⣿⣆
⢸⣿⠀⢸⣿⡇⠀⠀⠀⠀⠀⠈⠉⠁⠀⠀⠀⣿⡇⣀⣠⣴⣾⣮⣝⠿⠿⠿⣻⡟
⢸⣿⠀⠘⣿⡇⠀⠀⠀⠀⠀⠀⠀⣠⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠉⠀
⠸⣿⠀⠀⣿⡇⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀⠀⠀
⠀⠻⣷⣶⣿⣇⠀⠀⠀⢠⣼⣿⣿⣿⣿⣿⣿⣿⣛⣛⣻⠉⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢸⣿⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢸⣿⣀⣀⣀⣼⡿⢿⣿⣿⣿⣿⣿⡿⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠈⠛⠻⠿⠿⠿⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀```"""
)
else:
await ctx.reply(
"""
```
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣤⣤⣤⣤⣶⣦⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⠛⠉⠙⠛⠛⠛⠛⠻⢿⣿⣷⣤⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠈⢻⣿⣿⡄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⡏⠀⠀⠀⣠⣶⣾⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣄⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⢰⣿⣿⣯⠁⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣷⡄⠀
⠀⠀⣀⣤⣴⣶⣶⣿⡟⠀⠀⠀⢸⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣷⠀
⠀⢰⣿⡟⠋⠉⣹⣿⡇⠀⠀⠀⠘⣿⣿⣿⣿⣷⣦⣤⣤⣤⣶⣶⣶⣶⣿⣿⣿⠀
⠀⢸⣿⡇⠀⠀⣿⣿⡇⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀
⠀⣸⣿⡇⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠉⠻⠿⣿⣿⣿⣿⡿⠿⠿⠛⢻⣿⡇⠀⠀
⠀⣿⣿⠁⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣧⠀⠀
⠀⣿⣿⠀⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀
⠀⣿⣿⠀⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀
⠀⢿⣿⡆⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀
⠀⠸⣿⣧⡀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠃⠀⠀
⠀⠀⠛⢿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⣰⣿⣿⣷⣶⣶⣶⣶⠶⠀⢠⣿⣿⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⣽⣿⡏⠁⠀⠀⢸⣿⡇⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⢹⣿⡆⠀⠀⠀⣸⣿⠇⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢿⣿⣦⣄⣀⣠⣴⣿⣿⠁⠀⠈⠻⣿⣿⣿⣿⡿⠏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⠛⠻⠿⠿⠿⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀```
"""
)
@commands.command(name="lewd")
async def lewd(self, ctx: commands.Context):
if not ctx.message.channel.is_nsfw():
await ctx.send("You can only use this command in NSFW channels")
return
import lewds
# await ctx.send(
# embed=core_utils.generate_embed(
# embed_url=lewds.get_lewd(),
# embed_title="{} is being lewd".format(ctx.message.author.name),
# )
# )
await ctx.reply(
embed=core_utils.generate_embed(
embed_title="{} is being lewd".format(ctx.message.author.name),
embed_url=core_utils.waifu_pics(
endpoint=random.choice(["waifu", "neko", "blowjob"]), nsfw=True
),
)
)
def setup(bot):
bot.add_cog(Cheeky(bot))