This repository was archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPhotography.py
77 lines (69 loc) · 3.28 KB
/
Photography.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import discord
from discord.ext.commands import errors
import Util
import random
from discord.ext import commands
import dpytools.checks
class Photography(commands.Cog):
"""
Contains commands for making posts for Photography Club
"""
def __init__(self, client):
self.client = client
self.RawChannel = 825054209338376194
self.EditedChannel = 825054426925498389
HangoutChannel = 825055154201821244
@commands.command(name="postraw", help="Posts attachment to the Raw Clicks channel")
@dpytools.checks.in_these_channels(HangoutChannel)
async def postraw(self, ctx, *, description=None):
#if ctx.channel.id == self.HangoutChannel:
if not len(ctx.message.attachments) < 1:
if not len(description) < 1:
postembed = discord.Embed(title="{}".format(
description), colour=random.randint(0, 0xffffff))
postembed.set_image(url=ctx.message.attachments[0].url)
postembed.set_author(name="{}".format(
ctx.message.author.display_name), icon_url=ctx.message.author.avatar_url)
sent = await self.client.get_channel(self.RawChannel).send(embed=postembed)
await ctx.message.delete()
await sent.add_reaction("❤")
else:
await ctx.send("Make sure you provide a caption to your image. `?rawpost CAPTION`")
await ctx.message.delete()
else:
await ctx.send("Please attatch a lovely image")
await ctx.message.delete()
#else:
# await ctx.send("You can't do that here. Please go to <#{}>".format(self.HangoutChannel))
# await ctx.message.delete()
@postraw.error
async def postrawerror(self, ctx, error):
await Util.ErrorHandler(ctx, error)
@commands.command(name="postedited", help="Posts attachment to the Edited Pictures channel")
@dpytools.checks.in_these_channels(HangoutChannel)
async def postedited(self, ctx, *, description=None):
#if ctx.channel.id == self.HangoutChannel:
if not len(ctx.message.attachments) < 1:
if not len(description) < 1:
postembed = discord.Embed(title="{}".format(
description), colour=random.randint(0, 0xffffff))
postembed.set_image(url=ctx.message.attachments[0].url)
postembed.set_author(name="{}".format(
ctx.message.author.display_name), icon_url=ctx.message.author.avatar_url)
sent = await self.client.get_channel(self.EditedChannel).send(embed=postembed)
await ctx.message.delete()
await sent.add_reaction("❤")
else:
await ctx.send("Make sure you provide a caption to your image. `?editedpost CAPTION`")
await ctx.message.delete()
else:
await ctx.send("Please attatch a lovely image")
await ctx.message.delete()
#else:
# await ctx.send("You can't do that here. Please go to <#{}>".format(self.HangoutChannel))
# await ctx.message.delete()
@postedited.error
async def posteditederror(self, ctx, error):
await Util.ErrorHandler(ctx, error)
def setup(client):
client.add_cog(Photography(client))