dragon-bot/app/cogs/cheeky_functions.py

169 lines
5.2 KiB
Python

from discord.ext import commands
import core_utils
import discord
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.reply(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.reply(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.reply(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="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=["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="ask")
async def ask(self, ctx: commands.Context):
import questions
await ctx.reply(
questions.answer_question(ctx.message.content),
)
@commands.command(name="meme")
async def meme(self, ctx: commands.Context):
import meme_gen
await ctx.message.delete()
await ctx.send(
embed=core_utils.generate_embed(
embed_url=meme_gen.parse_message(ctx.message.content)
)
)
@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)
def setup(bot):
bot.add_cog(Cheeky(bot))