Selaa lähdekoodia

Merge branch 'alpha'

tags/v2.0.0
Roxie Gibson 6 vuotta sitten
vanhempi
commit
8bc3937768
2 muutettua tiedostoa jossa 125 lisäystä ja 12 poistoa
  1. +1
    -1
      roxbot/cogs/fun.py
  2. +124
    -11
      roxbot/cogs/image.py

+ 1
- 1
roxbot/cogs/fun.py Näytä tiedosto

@@ -92,7 +92,7 @@ class Fun:

m = re.findall('(-?)((?:(\d*)d(\d+))|\d+)(r\d+)?([h,l]{1}\d+)?', parts[0])

if m: # either no arguments, or the expression contained nothing that could be seen as a number or roll
if not m: # either no arguments, or the expression contained nothing that could be seen as a number or roll
return await ctx.send("Expression missing. If you are unsure of what the format should be, please use `{}help roll`".format(ctx.prefix))

dice = [] # this is the list of all dice sets to be rolled

+ 124
- 11
roxbot/cogs/image.py Näytä tiedosto

@@ -199,7 +199,8 @@ class ImageEditor:
async def pride(self, ctx):
"""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."""
pass
logging = roxbot.guild_settings.get(ctx.guild).logging
self.log_channel = self.bot.get_channel(logging["channel"])

@pride.command()
async def lgbt(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -217,8 +218,19 @@ class ImageEditor:
flag = PrideFlags.lgbt()
async with ctx.typing():
file = await self.flag_filter("lgbt", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def transgender(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -236,8 +248,19 @@ class ImageEditor:
flag = PrideFlags.trans()
async with ctx.typing():
file = await self.flag_filter("trans", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def nonbinary(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -255,8 +278,19 @@ class ImageEditor:
flag = PrideFlags.non_binary()
async with ctx.typing():
file = await self.flag_filter("nb", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def bisexual(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -274,8 +308,19 @@ class ImageEditor:
flag = PrideFlags.bi()
async with ctx.typing():
file = await self.flag_filter("bi", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def genderqueer(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -293,8 +338,19 @@ class ImageEditor:
flag = PrideFlags.gq()
async with ctx.typing():
file = await self.flag_filter("gq", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def pansexual(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -312,8 +368,19 @@ class ImageEditor:
flag = PrideFlags.pan()
async with ctx.typing():
file = await self.flag_filter("pan", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def asexual(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -331,8 +398,19 @@ class ImageEditor:
flag = PrideFlags.ace()
async with ctx.typing():
file = await self.flag_filter("ace", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def genderfluid(self, ctx, image: roxbot.converters.AvatarURL = None):
@@ -350,8 +428,19 @@ class ImageEditor:
flag = PrideFlags.gf()
async with ctx.typing():
file = await self.flag_filter("pan", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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()
async def agender(self, ctx, image: roxbot.converters.AvatarURL = None):
@@ -369,8 +458,19 @@ class ImageEditor:
flag = PrideFlags.agender()
async with ctx.typing():
file = await self.flag_filter("gf", flag, image)
await ctx.send(file=file)
output = await ctx.send(file=file)
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"])
async def deepfry(self, ctx, image: roxbot.converters.AvatarURL=None):
@@ -382,6 +482,8 @@ class ImageEditor:
Provide a URL, 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:
image = self.image_lookup(ctx.message)
filename = await roxbot.http.download_file(image)
@@ -428,8 +530,19 @@ class ImageEditor:
img = img.convert(mode="RGB")
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)
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):

Loading…
Peruuta
Tallenna