Make 'some' changes and add Dockerfile

This commit is contained in:
Marco Thomas
2020-08-31 14:19:43 +02:00
parent 8b54dcf968
commit 6be6e96768
23 changed files with 129 additions and 179 deletions

View File

@@ -1,11 +1,5 @@
"""
Admin commands, that can be used from within the chat:
- load
- unload
- reload
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
Admin commands, that can be used from within the discord-client-chat
"""
# IMPORTS

View File

@@ -1,10 +1,5 @@
"""
Some anime-related commands:
- animepic
- waifupic
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
Some anime-related commands
"""
# IMPORTS - external

View File

@@ -1,7 +1,5 @@
"""
This framework can be used to create new Cogs, remember to add them in the config
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS
@@ -17,4 +15,4 @@ class Foo(commands.Cog):
# COG ENDING
def setup(bot):
bot.add_cog(Foo(bot))
bot.add_cog(Foo(bot))

View File

@@ -1,25 +0,0 @@
"""
Some general commands:
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS - external
import discord
from discord.ext import commands
import platform
# IMPORTS - internal
import loadconfig
# COG INIT
class General(commands.Cog):
def __init__(self, bot):
self.bot = bot
# COG BODY
# COG ENDING
def setup(bot):
bot.add_cog(General(bot))

View File

@@ -1,8 +1,5 @@
"""
Some help for the users:
- aquabot
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
Some help for the users
"""
# IMPORTS - external
@@ -10,7 +7,7 @@ import discord
from discord.ext import commands
# IMPORTS - internal
import loadconfig
from __main__ import prefix
# COG INIT
class Help(commands.Cog):
@@ -27,7 +24,7 @@ class Help(commands.Cog):
embed.set_thumbnail(url=ctx.me.avatar_url)
embed.add_field(name="Owner", value=self.bot.AppInfo.owner, inline=True)
embed.add_field(name="Command Prefix", value=loadconfig.__prefix__, inline=True)
embed.add_field(name="Command Prefix", value=prefix, inline=True)
embed.add_field(name="Source Code", value="[GitHub](https://github.com/crammk/aquabot)", inline=True)
footer_text = "This Bot is a project by MarcMK."

View File

@@ -1,7 +1,5 @@
"""
Send spicy memes to chat
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS - external
@@ -12,9 +10,6 @@ import random
# IMPORTS - internal
import loaddata
class MemeError(Exception):
pass
# COG INIT
class Meme(commands.Cog):
def __init__(self, bot):

View File

@@ -1,7 +1,7 @@
"""
Play Music
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
A COG NOT WRITTEN BY ME! ALTERED FROM THIS ONE:
https://gist.github.com/vbe0201/ade9b80f2d3b64643d854938d40a0a2d
"""

41
cogs/reddit.py Normal file
View File

@@ -0,0 +1,41 @@
"""
Fetch pictures from subreddits
"""
# IMPORTS - external
import discord
from discord.ext import commands
import random
import praw
# IMPORTS - internal
from __main__ import reddit_client_id
from __main__ import reddit_client_secret
from __main__ import reddit_client_useragent
# COG INIT
class Reddit(commands.Cog):
def __init__(self, bot):
self.bot = bot
# COG BODY
@commands.command(name="reddit")
async def reddit(self, ctx, sub: str):
"""
Send a post from a subreddit to chat
"""
reddit = praw.Reddit(client_id=reddit_client_id,
client_secret=reddit_client_secret,
user_agent=reddit_client_useragent)
posts = reddit.subreddit(sub).hot()
rand_post = random.randint(1, 100)
# Make sure you're not sending a pinned post
for i in range(0, rand_post):
selected_post = next(x for x in posts if not x.stickied)
await ctx.send(selected_post.url)
# COG ENDING
def setup(bot):
bot.add_cog(Reddit(bot))

View File

@@ -1,7 +1,5 @@
"""
A simple reminder option
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS

View File

@@ -1,9 +1,5 @@
"""
Some (more or less) handy utility:
- invitelink
- pat
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
Some (more or less) handy utility
"""
# IMPORTS - external
@@ -12,7 +8,7 @@ from discord.ext import commands
import random
# IMPORTS - internal
import loadconfig
from __main__ import avatar
# COG INIT
class Utility(commands.Cog):
@@ -43,7 +39,7 @@ class Utility(commands.Cog):
inline=True)
link_embed.set_footer(
text=f"Age: {age}, Uses: {uses}",
icon_url=loadconfig.__avatar__
icon_url=avatar
)
await ctx.send(embed=link_embed)
@@ -58,8 +54,6 @@ class Utility(commands.Cog):
author = ctx.message.author
if target is None:
response = "No one to pat..."
elif target.capitalize() == "Noel":
response = "NNN-GYAAAA!"
else:
response = f"{target} got pat by {author.mention}"

View File

@@ -1,12 +1,7 @@
"""
Welcoming new users etc.:
- listener: join
- hello
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
Welcoming new users etc.
"""
# IMPORTS
import discord
from discord.ext import commands