-
Notifications
You must be signed in to change notification settings - Fork 2
/
memes.py
39 lines (30 loc) · 1.01 KB
/
memes.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
from discord.ext import tasks
from assets import client,colors,reddit
import random
from discord import Embed
@tasks.loop(hours = 12)
async def send_memes():
Channel = client.get_channel(807937662899847188)
all_subs = []
subreddit = reddit.subreddit("ProgrammerHumor")
top = subreddit.hot(limit=50)
for submission in top:
all_subs.append(submission)
random_sub = random.choice(all_subs)
name = random_sub.title
url = random_sub.url
embed = Embed(title=name, colour = random.choice(colors))
embed.set_image(url=url)
await Channel.send(embed=embed)
async def SendMeme(message):
all_subs = []
subreddit = reddit.subreddit("ProgrammerHumor")
top = subreddit.hot(limit=50)
for submission in top:
all_subs.append(submission)
random_sub = random.choice(all_subs)
name = random_sub.title
url = random_sub.url
embed = Embed(title=name, colour = random.choice(colors))
embed.set_image(url=url)
await message.channel.send(embed=embed)