Browse Source

emergency logging for image editing commands.

tags/v2.0.0
Roxie Gibson 6 years ago
parent
commit
bf289902ea
1 changed files with 124 additions and 11 deletions
  1. +124
    -11
      roxbot/cogs/image.py

+ 124
- 11
roxbot/cogs/image.py View File

async def pride(self, ctx): async def pride(self, ctx):
"""A collection of filters that show simple LGBT pride flags over the image provided. """A collection of filters that show simple LGBT pride flags over the image provided.
The filters work with either your pfp, someone elses', or an image provided either by attachment or URL.""" The filters work with either your pfp, someone elses', or an image provided either by attachment or URL."""
pass
logging = roxbot.guild_settings.get(ctx.guild).logging
self.log_channel = self.bot.get_channel(logging["channel"])


@pride.command() @pride.command()
async def lgbt(self, ctx, image: roxbot.converters.AvatarURL=None): async def lgbt(self, ctx, image: roxbot.converters.AvatarURL=None):
flag = PrideFlags.lgbt() flag = PrideFlags.lgbt()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("lgbt", flag, image) file = await self.flag_filter("lgbt", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command(aliases=["trans"]) @pride.command(aliases=["trans"])
async def transgender(self, ctx, image: roxbot.converters.AvatarURL=None): async def transgender(self, ctx, image: roxbot.converters.AvatarURL=None):
flag = PrideFlags.trans() flag = PrideFlags.trans()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("trans", flag, image) file = await self.flag_filter("trans", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command(aliases=["nb", "enby"]) @pride.command(aliases=["nb", "enby"])
async def nonbinary(self, ctx, image: roxbot.converters.AvatarURL=None): async def nonbinary(self, ctx, image: roxbot.converters.AvatarURL=None):
flag = PrideFlags.non_binary() flag = PrideFlags.non_binary()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("nb", flag, image) file = await self.flag_filter("nb", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command(aliases=["bi"]) @pride.command(aliases=["bi"])
async def bisexual(self, ctx, image: roxbot.converters.AvatarURL=None): async def bisexual(self, ctx, image: roxbot.converters.AvatarURL=None):
flag = PrideFlags.bi() flag = PrideFlags.bi()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("bi", flag, image) file = await self.flag_filter("bi", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command(aliases=["gq"]) @pride.command(aliases=["gq"])
async def genderqueer(self, ctx, image: roxbot.converters.AvatarURL=None): async def genderqueer(self, ctx, image: roxbot.converters.AvatarURL=None):
flag = PrideFlags.gq() flag = PrideFlags.gq()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("gq", flag, image) file = await self.flag_filter("gq", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command(aliases=["pan"]) @pride.command(aliases=["pan"])
async def pansexual(self, ctx, image: roxbot.converters.AvatarURL=None): async def pansexual(self, ctx, image: roxbot.converters.AvatarURL=None):
flag = PrideFlags.pan() flag = PrideFlags.pan()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("pan", flag, image) file = await self.flag_filter("pan", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command(aliases=["ace"]) @pride.command(aliases=["ace"])
async def asexual(self, ctx, image: roxbot.converters.AvatarURL=None): async def asexual(self, ctx, image: roxbot.converters.AvatarURL=None):
flag = PrideFlags.ace() flag = PrideFlags.ace()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("ace", flag, image) file = await self.flag_filter("ace", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command(aliases=["gf"]) @pride.command(aliases=["gf"])
async def genderfluid(self, ctx, image: roxbot.converters.AvatarURL = None): async def genderfluid(self, ctx, image: roxbot.converters.AvatarURL = None):
flag = PrideFlags.gf() flag = PrideFlags.gf()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("pan", flag, image) file = await self.flag_filter("pan", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@pride.command() @pride.command()
async def agender(self, ctx, image: roxbot.converters.AvatarURL = None): async def agender(self, ctx, image: roxbot.converters.AvatarURL = None):
flag = PrideFlags.agender() flag = PrideFlags.agender()
async with ctx.typing(): async with ctx.typing():
file = await self.flag_filter("gf", flag, image) file = await self.flag_filter("gf", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
os.remove(file.filename) os.remove(file.filename)
await roxbot.log(
ctx.guild,
self.log_channel,
"pride",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)


@commands.command(aliases=["df"]) @commands.command(aliases=["df"])
async def deepfry(self, ctx, image: roxbot.converters.AvatarURL=None): async def deepfry(self, ctx, image: roxbot.converters.AvatarURL=None):
Provide a URL, that image Provide a URL, that image
Provide an image via upload, that image. Provide an image via upload, that image.
""" """
logging = roxbot.guild_settings.get(ctx.guild).logging
log_channel = self.bot.get_channel(logging["channel"])
if not image: if not image:
image = self.image_lookup(ctx.message) image = self.image_lookup(ctx.message)
filename = await roxbot.http.download_file(image) filename = await roxbot.http.download_file(image)
img = img.convert(mode="RGB") img = img.convert(mode="RGB")
img.save(jpg_name) img.save(jpg_name)


await ctx.send(file=discord.File(jpg_name))
output = await ctx.send(file=discord.File(jpg_name))
os.remove(jpg_name) os.remove(jpg_name)
await roxbot.log(
ctx.guild,
log_channel,
"deepfry",
User=ctx.author,
User_ID=ctx.author.id,
Output_Message_ID=output.id,
Channel=ctx.channel,
Channel_Mention=ctx.channel.mention,
Time="{:%a %Y/%m/%d %H:%M:%S} UTC".format(ctx.message.created_at)
)




def setup(bot_client): def setup(bot_client):

Loading…
Cancel
Save