-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMewo-bot.py
70 lines (52 loc) · 2.32 KB
/
Mewo-bot.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
import discord
import praw
from discord.ext import commands
import Information
client = commands.Bot(command_prefix="mewo.", case_insensitive=True)
Token = Information.TOKEN
reddit = praw.Reddit(client_id=Information.REDDIT_APP_ID,
client_secret=Information.REDDIT_APP_SECRET,
user_agent='<console:Mewo:0.0.1 (by /u/Ruo_Childe)>',
username='Ruo_Childe',
password=Information.Reddit_pass,
check_for_async=False)
# subreddits = ['Cats', 'IllegallySmolCats', 'Kitty', 'GrumpyCats','fatcats','AdorableCats','CatLoaf','Purrito',
# 'Catbaguette','noodlebones','CatMemes']
subreddits = ['catpictures']
@client.event
async def on_ready():
channel = client.get_channel(962409619353895016)
await channel.send("Meow has landed!")
@client.event
async def on_disconnect():
channel = client.get_channel(851169143767302154)
await channel.send("Au revoir!")
@client.command(name="hi" or "hello")
async def hi(ctx):
await ctx.message.channel.send("AYO!")
help_embed = discord.Embed(title="Mewo?", description="At your service!", color=0xECD7D5)
help_embed.add_field(name="Name: ", value="Mewo")
help_embed.add_field(name="Age: ", value="Cat")
help_embed.add_field(name="Occupation: ", value="Unemployed but still richer than you", inline=False)
help_embed.add_field(name="Hobbies: ", value="Sending cat pictures", inline=False)
help_embed.set_footer(text="℗ Copyright Mewo Corp 2022")
@client.command(name="helpme")
async def helpme_func(ctx):
await ctx.message.channel.send(embed=help_embed)
@client.command(name="meow")
async def meow_func(ctx):
global subreddits
for submission in reddit.subreddit('catpictures').top(limit=None):
url = submission.url
if url.endswith(('.jpg', '.png', '.gif', '.jpeg')):
meow_pic = url
redditor = submission.author
post_title = submission.title
post_url = str(submission.permalink)
# create embed with cat picture
meow_embed = discord.Embed(title=f"Meow:", description=f"[{post_title}](https://reddit.com{post_url})", color=0xECD7D5)
meow_embed.add_field(name="Redditor:", value=str(redditor), inline=False)
meow_embed.set_image(url=meow_pic)
await ctx.message.channel.send(embed=meow_embed)
# Run the bot
client.run(Token)