First working version
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
__pycache__/
|
||||
config/config.py
|
||||
16
README.md
16
README.md
@@ -1,3 +1,5 @@
|
||||

|
||||
|
||||
AquaBot
|
||||
=======
|
||||
|
||||
@@ -18,14 +20,14 @@ Use `pip install discord.py` to install the latest version of discord.py.
|
||||
Then, after cloning this repository with
|
||||
`git clone https://github.com/crammk/aquabot`, you can run the `aquabot.py`.
|
||||
|
||||
Config
|
||||
------
|
||||
|
||||
To use the bot you need to add a `config/config.py` file. For reference, see
|
||||
`config/config_example.py`.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
python>=3.6.0
|
||||
discord.py>=1.0.0a
|
||||
|
||||
|
||||
BIGGER TODOS
|
||||
------------
|
||||
+ Auto-Installing requirements
|
||||
+ Separate config directory
|
||||
discord.py>=1.0.0a
|
||||
33
aquabot.py
33
aquabot.py
@@ -6,26 +6,27 @@
|
||||
# This project uses discordpy
|
||||
# https://discordpy.readthedocs.io/en/latest/intro.html
|
||||
|
||||
# IMPORTS
|
||||
# IMPORTS - external
|
||||
import discord
|
||||
from discord.utils import commands
|
||||
from discord.ext import commands
|
||||
|
||||
# IMPORTS - internal
|
||||
import loadconfig
|
||||
|
||||
# CONSTANTS
|
||||
BOT_TOKEN = ""
|
||||
COMMAND_PREFIX = ""
|
||||
|
||||
|
||||
# INIT
|
||||
bot = commands.Bot(command_prefix=COMMAND_PREFIX, description="Holy Goddess Aqua!")
|
||||
bot = commands.Bot(
|
||||
command_prefix=loadconfig.__prefix__,
|
||||
description="Holy Goddess Aqua!"
|
||||
)
|
||||
|
||||
inital_extensions = [
|
||||
"cogs.admin",
|
||||
"cogs.general",
|
||||
"cogs.welcome"
|
||||
]
|
||||
|
||||
if __name__ == "__main__":
|
||||
for extension in inital_extensions:
|
||||
bot.load_extension(extension)
|
||||
for cog in loadconfig.__cogs__:
|
||||
try:
|
||||
bot.load_extension(cog)
|
||||
except Exception:
|
||||
print(f"Error while trying to load cog {cog}")
|
||||
|
||||
# BOT
|
||||
# https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
|
||||
@@ -36,11 +37,11 @@ async def on_ready():
|
||||
Version: {discord.__version__}\n
|
||||
""")
|
||||
|
||||
status = f"Hentai | {COMMAND_PREFIX}aquabot"
|
||||
status = f"Hentai | {loadconfig.__prefix__}aquabot"
|
||||
activity = discord.Activity(name=status, type=discord.ActivityType.watching)
|
||||
await bot.change_presence(activity=activity)
|
||||
|
||||
print(f"AquaBot is ready!\n")
|
||||
|
||||
|
||||
bot.run(BOT_TOKEN, bot=True, reconnect=True)
|
||||
bot.run(loadconfig.__token__, bot=True, reconnect=True)
|
||||
@@ -20,7 +20,7 @@ class AdminCog(commands.Cog):
|
||||
# used as "load cogs.COGNAME"
|
||||
@commands.command(name="load", hidden=True)
|
||||
@commands.is_owner()
|
||||
async def cog_load(self, ctx, *, cog: str):
|
||||
async def load(self, ctx, *, cog: str):
|
||||
|
||||
try:
|
||||
self.bot.load_extension(cog)
|
||||
@@ -33,7 +33,7 @@ class AdminCog(commands.Cog):
|
||||
# used as "unload cogs.COGNAME"
|
||||
@commands.command(name="unload", hidden=True)
|
||||
@commands.is_owner()
|
||||
async def cog_unload(self, ctx, *, cog: str):
|
||||
async def unload(self, ctx, *, cog: str):
|
||||
|
||||
try:
|
||||
self.bot.unload_extension(cog)
|
||||
@@ -46,7 +46,7 @@ class AdminCog(commands.Cog):
|
||||
# used as "reload cogs.COGNAME"
|
||||
@commands.command(name="reload", hidden=True)
|
||||
@commands.is_owner()
|
||||
async def cog_reload(self, ctx, *, cog: str):
|
||||
async def reload(self, ctx, *, cog: str):
|
||||
|
||||
try:
|
||||
self.bot.unload_extension(cog)
|
||||
@@ -59,4 +59,4 @@ class AdminCog(commands.Cog):
|
||||
|
||||
# COG ENDING
|
||||
def setup(bot):
|
||||
bot.add_cog(AdminCog(bot))
|
||||
bot.add_cog(AdminCog(bot))
|
||||
@@ -36,7 +36,7 @@ class GeneralCog(commands.Cog):
|
||||
author = ctx.message.author
|
||||
if target is None:
|
||||
response = "No one to pat..."
|
||||
else if target.capitalize == "Noel":
|
||||
elif target == "Noel":
|
||||
response = "NNN-GYAAAA!"
|
||||
else:
|
||||
response = f"{target.mention} got pat by {author.mention}"
|
||||
@@ -46,4 +46,4 @@ class GeneralCog(commands.Cog):
|
||||
|
||||
# COG ENDING
|
||||
def setup(bot):
|
||||
bot.add_cog(GeneralCog(bot))
|
||||
bot.add_cog(GeneralCog(bot))
|
||||
10
cogs/help.py
10
cogs/help.py
@@ -4,7 +4,7 @@
|
||||
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
|
||||
#
|
||||
|
||||
# IMPORTS
|
||||
# IMPORTS - exter
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
@@ -15,17 +15,17 @@ class HelpCog(commands.Cog):
|
||||
|
||||
# COG BODY
|
||||
@commands.command(
|
||||
name="aquabot"
|
||||
name="aquabot",
|
||||
description="Prints a short help for new users"
|
||||
)
|
||||
async def aquabot(self, ctx):
|
||||
|
||||
await ctx.send("""
|
||||
I'm the usele... divine AquaBot!\n
|
||||
If you need help, try using the `help` command!\n
|
||||
I'm the usele... divine AquaBot!
|
||||
If you need help, try using the `help` command!
|
||||
""")
|
||||
|
||||
|
||||
# COG ENDING
|
||||
def setup(bot):
|
||||
bot.add_cog(HelpCog(bot))
|
||||
bot.add_cog(HelpCog(bot))
|
||||
@@ -19,7 +19,7 @@ class WelcomeCog(commands.Cog):
|
||||
|
||||
channel = member.guild.system_channel
|
||||
text = f"Welcome {member.mention} to our useless Discord!"
|
||||
if channel is Not None:
|
||||
if channel is not None:
|
||||
await channel.send(text)
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ class WelcomeCog(commands.Cog):
|
||||
)
|
||||
async def hello(self, ctx):
|
||||
|
||||
await ctx.send(f"Hello {ctx.author}!")
|
||||
await ctx.send(f"Hello {ctx.author.mention}!")
|
||||
|
||||
# COG ENDING
|
||||
def setup(bot):
|
||||
bot.add_cog(WelcomeCog(bot))
|
||||
bot.add_cog(WelcomeCog(bot))
|
||||
0
config/__init__.py
Normal file
0
config/__init__.py
Normal file
7
config/cogs.py
Normal file
7
config/cogs.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# Initally loaded cogs
|
||||
__cogs__ = [
|
||||
"cogs.admin",
|
||||
"cogs.general",
|
||||
"cogs.welcome",
|
||||
"cogs.help"
|
||||
]
|
||||
4
config/config_example.py
Normal file
4
config/config_example.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# This is a sample file for how a config file looks like
|
||||
|
||||
__token__ = "Discord Auth Token"
|
||||
__prefix__ = "Command Prefix"
|
||||
BIN
img/avatar.png
Normal file
BIN
img/avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
5
loadconfig.py
Normal file
5
loadconfig.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# Gather all config data into one file
|
||||
# loadconfig.py then gets called in aquabot.py
|
||||
from config.cogs import __cogs__
|
||||
|
||||
from config.config import __token__, __prefix__
|
||||
@@ -1,386 +0,0 @@
|
||||
#################################
|
||||
### AquaBot created by MarcMK ###
|
||||
### Project started ###
|
||||
### on 17.09.2019 ###
|
||||
### Aqua Best Girl! ###
|
||||
#################################
|
||||
|
||||
##############
|
||||
### IMPORT ###
|
||||
##############
|
||||
|
||||
import discord
|
||||
import logging
|
||||
import random
|
||||
from discord.ext import commands
|
||||
from discord.utils import get
|
||||
|
||||
# https://github.com/Giphy/giphy-python-client#installation--usage
|
||||
# pip install giphy_client
|
||||
import giphy_client
|
||||
from giphy_client.rest import ApiException
|
||||
|
||||
# ffmpeg - still unused
|
||||
# youtube_dl - still unused
|
||||
|
||||
##############
|
||||
### TOKENS ###
|
||||
##############
|
||||
|
||||
GIPHY_API_KEY = ""
|
||||
BOT_TOKEN = ""
|
||||
|
||||
####################
|
||||
### INITIALIZERS ###
|
||||
####################
|
||||
|
||||
bot = commands.Bot(command_prefix = ".")
|
||||
prefix = "."
|
||||
token = BOT_TOKEN
|
||||
bot.remove_command("help")
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logging.basicConfig(level=logging.CRITICAL)
|
||||
|
||||
##############
|
||||
### EVENTS ###
|
||||
##############
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
name = f"Hentai | {prefix}aquabot"
|
||||
activity = discord.Activity(name=name, type=discord.ActivityType.watching)
|
||||
await bot.change_presence(activity=activity)
|
||||
print(f"AquaBot is ready!\n")
|
||||
|
||||
@bot.event
|
||||
async def on_member_join(member):
|
||||
text = 'Welcome {} to our Discord! I am the usele... divine AquaBot!'.format(member.mention)
|
||||
channel = bot.get_channel(541637988120133634)
|
||||
await channel.send(text)
|
||||
|
||||
############
|
||||
### HELP ###
|
||||
############
|
||||
|
||||
@bot.command(aliases=["aquabot"])
|
||||
async def help(ctx):
|
||||
embed_help = discord.Embed(colour = discord.Colour.blue())
|
||||
|
||||
text = f"All commands were split up into these categories.\n For furter explanation, use e.g. `{prefix}commands general`\n"
|
||||
embed_help.add_field(name="I'm the usele... divine AquaBot!", value=text, inline=False)
|
||||
|
||||
embed_help.add_field(name="• General", value="Guess what...", inline=True)
|
||||
embed_help.add_field(name="• Media", value="Sounds, GIFS, ...", inline=True)
|
||||
embed_help.add_field(name="• Axisbot", value="Praaaay!", inline=True)
|
||||
embed_help.add_field(name="• Waifu", value="Best Girl Stuff", inline=True)
|
||||
embed_help.add_field(name="• Steam", value="Configs, Profiles, ...", inline=True)
|
||||
embed_help.add_field(name="• Support", value="Need even more help?", inline=True)
|
||||
|
||||
link = "https://external-preview.redd.it/9n8rYQUzOck_C54YtzXt8qOFW_rY71-AZZHljtj14qw.jpg?auto=webp&s=aad1bc4546806bc435da29e4502e10442f298f2f"
|
||||
embed_help.set_footer(text="AquaBot made by MarcMK.", icon_url=link)
|
||||
await ctx.send(embed=embed_help)
|
||||
|
||||
### COMMANDS ###
|
||||
|
||||
@bot.command(aliases=["command"])
|
||||
async def commands(ctx, command):
|
||||
command_list = ["general", "media", "axisbot", "waifu", "steam", "support"]
|
||||
if command in command_list:
|
||||
embed_commands = discord.Embed(colour = discord.Colour.blue())
|
||||
|
||||
general = f"`{prefix}aquabot`\n`{prefix}useless`\n`{prefix}pat [@target]`\n`{prefix}invitelink`\n`{prefix}boost`\n`{prefix}senpainoticeme`\n`{prefix}maddlesticks`\n`{prefix}flame [target_name]`\n"
|
||||
|
||||
media = f"`{prefix}gif [tag]`\n`{prefix}listgif`\n`{prefix}join`\n`{prefix}leave`\n`{prefix}play [file]`\n"
|
||||
|
||||
axisbot = f"`{prefix}axisbot `\n`{prefix}pray`\n"
|
||||
|
||||
waifu = f"`{prefix}waifuwar [waifu] [waifu]`\n`{prefix}waifupicture`\n"
|
||||
|
||||
steam = f"`{prefix}steam [name]`\n`{prefix}steamid [id]`\n`{prefix}marcconfig`\n"
|
||||
|
||||
support = "`WIP!`"
|
||||
|
||||
if command == "general":
|
||||
text_val = general
|
||||
elif command == "media":
|
||||
text_val = media
|
||||
elif command == "axisbot":
|
||||
text_val = axisbot
|
||||
elif command == "waifu":
|
||||
text_val = waifu
|
||||
elif command == "steam":
|
||||
text_val = steam
|
||||
else:
|
||||
text_val = support
|
||||
|
||||
embed_commands.add_field(name=f"Here are all commands from `{command}`\nPro tip: Argument `list` shows all possible arguments from a command.", value=text_val, inline=True)
|
||||
await ctx.send(embed=embed_commands)
|
||||
else:
|
||||
await ctx.send("> Categorie not found!")
|
||||
|
||||
########################
|
||||
### GENERAL COMMANDS ###
|
||||
########################
|
||||
|
||||
#useless
|
||||
@bot.command()
|
||||
async def useless(ctx):
|
||||
responses = ["I'm not useless!","You're useless!","Megumin is more useless!"]
|
||||
await ctx.send(f"> {random.choice(responses)}")
|
||||
|
||||
#BOOST BOOST BOOST
|
||||
@bot.command()
|
||||
async def boost(ctx):
|
||||
text1 = "BOOST! BOOST! BOOST! 🐲🐉"
|
||||
text2 = "Wait, this isn't my text..."
|
||||
await ctx.send(f">>> {text1} \n {text2}")
|
||||
|
||||
#pat
|
||||
@bot.command()
|
||||
async def pat(ctx, target_name):
|
||||
if target_name == "noel":
|
||||
await ctx.send("> NNN-GYAAAAAAA!")
|
||||
elif target_name == "Noel":
|
||||
await ctx.send("> NNN-GYAAAAAAA!")
|
||||
else:
|
||||
author = ctx.message.author
|
||||
text = '{} has head-patted {}!'.format(author.mention, target_name)
|
||||
await ctx.send(text)
|
||||
|
||||
@bot.command()
|
||||
async def senpainoticeme(ctx):
|
||||
await ctx.send(file=discord.File("./pictures/lorgst.png"))
|
||||
|
||||
@bot.command()
|
||||
async def maddlesticks(ctx):
|
||||
await ctx.send(file=discord.File("./pictures/fiddlesticksmarc.png"))
|
||||
|
||||
#Send Discord Invitelink to Channel
|
||||
@bot.command(aliases=["invitelink"])
|
||||
async def invite_link(ctx):
|
||||
await ctx.send("> Here is our invite link: https://discordapp.com/invite/HbYfyJT")
|
||||
|
||||
#Flames a player
|
||||
@bot.command()
|
||||
async def flame(ctx, user_name):
|
||||
insult_list = ["is useless!", "is worthless!"]
|
||||
insult = random.choice(insult_list)
|
||||
await ctx.send(f"> {user_name} {insult}")
|
||||
|
||||
######################
|
||||
### Media Commands ###
|
||||
######################
|
||||
|
||||
### GIPHY INITS / FUNCTIONS ###
|
||||
|
||||
#https://github.com/Giphy/giphy-python-client#installation--usage
|
||||
|
||||
api_key = GIPHY_API_KEY
|
||||
api_instance = giphy_client.DefaultApi()
|
||||
limit = 25
|
||||
offset = 0
|
||||
lang = "en"
|
||||
fmt = "json"
|
||||
|
||||
async def gif_search_init(searchterm):
|
||||
try:
|
||||
api_response_search = api_instance.gifs_search_get(
|
||||
api_key,
|
||||
searchterm,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
lang=lang,
|
||||
fmt=fmt)
|
||||
gif_list = list(api_response_search.data)
|
||||
gif = random.choices(gif_list)
|
||||
return gif[0].url
|
||||
except ApiException as exception:
|
||||
print("Exception when calling DefaultApi->gifs_search_get: %s\n" % exception)
|
||||
await channel
|
||||
|
||||
### GIPHY COMMANDS ###
|
||||
|
||||
@bot.command(aliases=["g"])
|
||||
async def gif(ctx, searchterm):
|
||||
gif = await gif_search_init(searchterm)
|
||||
await ctx.send(gif)
|
||||
|
||||
@bot.command(aliases=["listgif"])
|
||||
async def gif_list(ctx):
|
||||
embed_gif_list = discord.Embed(colour = discord.Colour.blue())
|
||||
gifs = f"`{prefix}konosubagif`\n`{prefix}megumingif`\n`{prefix}remgif`"
|
||||
embed_gif_list.add_field(name="Try one of these:", value=gifs, inline=True)
|
||||
await ctx.send(embed=embed_gif_list)
|
||||
|
||||
@bot.command(aliases=["konosubagif"])
|
||||
async def gif_konosuba(ctx):
|
||||
gif = await gif_search_init("konosuba")
|
||||
await ctx.send(gif)
|
||||
|
||||
@bot.command(aliases=["megumingif"])
|
||||
async def gif_megumin(ctx):
|
||||
gif = await gif_search_init("megumin")
|
||||
await ctx.send(gif)
|
||||
|
||||
@bot.command(aliases=["remgif"])
|
||||
async def gif_rem(ctx):
|
||||
gif = await gif_search_init("rem re:zero")
|
||||
await ctx.send(gif)
|
||||
|
||||
### SOUND SETUP ###
|
||||
|
||||
@bot.command(aliases=["j"])
|
||||
async def join(ctx):
|
||||
channel = ctx.message.author.voice.channel
|
||||
voice = get(bot.voice_clients, guild=ctx.guild)
|
||||
|
||||
if voice and voice.is_connected():
|
||||
await voice.move_to(channel)
|
||||
else:
|
||||
await channel.connect()
|
||||
await ctx.send("> Joined!")
|
||||
|
||||
@bot.command(aliases=["l", "quit"])
|
||||
async def leave(ctx):
|
||||
channel = ctx.message.author.voice.channel
|
||||
voice = get(bot.voice_clients, guild=ctx.guild)
|
||||
|
||||
await voice.disconnect()
|
||||
await ctx.send("> Left!")
|
||||
|
||||
#@bot.command()
|
||||
#async def play(ctx, url):
|
||||
# guild = ctx.message.guild
|
||||
# voice = get(bot.voice_clients, guild=ctx.guild)
|
||||
# player = await voice.create_ytdl_player(url)
|
||||
# player.start()
|
||||
|
||||
### SOUND CLIPS ###
|
||||
|
||||
@bot.command(aliases=["p"])
|
||||
async def play(ctx, file_name):
|
||||
voice = get(bot.voice_clients, guild=ctx.guild)
|
||||
channel = ctx.message.author.voice.channel
|
||||
|
||||
if file_name == "list":
|
||||
embed_help_chat = discord.Embed(colour = discord.Colour.blue())
|
||||
titles = open("sounds/AAAlist.txt", encoding="utf-8").read()
|
||||
embed_help_chat.add_field(name="Try one of these:", value=titles, inline=True)
|
||||
await ctx.send(embed=embed_help_chat)
|
||||
else:
|
||||
if voice and voice.is_connected():
|
||||
await voice.move_to(channel)
|
||||
else:
|
||||
await channel.connect()
|
||||
await ctx.send("> Joined!")
|
||||
location = "sounds/"
|
||||
ending = ".mp3"
|
||||
player = f"{location}{file_name}{ending}"
|
||||
voice = get(bot.voice_clients, guild=ctx.guild)
|
||||
voice.play(discord.FFmpegPCMAudio(player))
|
||||
voice.source.volume = 0.005
|
||||
|
||||
#########################
|
||||
### AXIS BOT COMMANDS ###
|
||||
#########################
|
||||
|
||||
#Main Command > needs more features
|
||||
@bot.command()
|
||||
async def axisbot(ctx):
|
||||
link = "> https://www.reddit.com/r/AquaSama/"
|
||||
gif_link = "> https://media.giphy.com/media/yiqkf0clPXvAk/giphy.gif"
|
||||
text = f"I see you're interested into the Axis Order? Come join us here: {link}"
|
||||
await ctx.send(gif_link)
|
||||
await ctx.send(text)
|
||||
|
||||
#Pray Function > Database? > Leveling System?
|
||||
@bot.command()
|
||||
async def pray(ctx):
|
||||
text = "> {0.mention} has prayed for the usel... divine Water Goddess Aqua!"
|
||||
await ctx.send(text.format(ctx.message.author))
|
||||
|
||||
######################
|
||||
### WAIFU COMMANDS ###
|
||||
######################
|
||||
|
||||
#Waifu Comparison
|
||||
@bot.command(aliases=["waifuwar"])
|
||||
async def waifu_war(ctx, waifu1, waifu2):
|
||||
waifu_list = [waifu1, waifu2]
|
||||
random1 = random.choice(waifu_list)
|
||||
if random1 == waifu1:
|
||||
random2 = waifu2
|
||||
else:
|
||||
random2 = waifu1
|
||||
text_list = ["is clearly superior to", "is waaaay better than"]
|
||||
text = random.choice(text_list)
|
||||
await ctx.send(f"> {random1} {text} {random2}!")
|
||||
|
||||
#Waifu Pictures
|
||||
@bot.command(aliases=["waifupicture", "waifupic"])
|
||||
async def waifu_picture(ctx, waifu):
|
||||
waifu_list = ["aqua", "akeno", "rem", "megumin"]
|
||||
if waifu in waifu_list:
|
||||
await ctx.send(file=discord.File(f"./pictures/{waifu}.jpg"))
|
||||
else:
|
||||
await ctx.send("> Your Waifu either sucks or is non-existent, so no picture will be send.")
|
||||
|
||||
######################
|
||||
### STEAM COMMANDS ###
|
||||
######################
|
||||
|
||||
#Send Steam Profiles with predefined Name
|
||||
@bot.command(aliases=["steam"])
|
||||
async def steam_profiles_name(ctx, name):
|
||||
embed = discord.Embed(colour = discord.Colour.blue())
|
||||
|
||||
profile_list = ["marc", "lorgst", "chikmalo", "jaron", "max"]
|
||||
if name in profile_list:
|
||||
profile_link = "https://ecosia.org"
|
||||
embed.add_field(name=f"Profile from `{name}`", value=profile_link, inline=True)
|
||||
elif name == "list":
|
||||
list = "`marc`\n`marc_smurf`\n`lorgst`\n`chikmalo`\n`jaron`\n`max`\n"
|
||||
embed.add_field(name="Available Profiles:", value=list, inline=True)
|
||||
else:
|
||||
embed.add_field(name="Steamprofile", value="Error.", inline=False)
|
||||
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
#Send Steam Profiles with ID
|
||||
@bot.command(aliases=["steamid"])
|
||||
async def steam_profiles_id(ctx, id):
|
||||
link = "https://steamcommunity.com/id/"
|
||||
output = f"{link}{id}"
|
||||
await ctx.send(output)
|
||||
|
||||
#Send my CS:GO Config to Channel
|
||||
@bot.command(aliases=["marcconfig"])
|
||||
async def marc_csgo_config(ctx):
|
||||
await ctx.send("Last updated on 19.09.2019:")
|
||||
with open("docs/marcexec.cfg", "rb") as fp:
|
||||
await ctx.send(file=discord.File(fp, "marcexec.cfg"))
|
||||
|
||||
#####################
|
||||
### TEST PURPOSES ###
|
||||
#####################
|
||||
|
||||
#send a pic
|
||||
#@bot.command()
|
||||
#async def fetchaqua(ctx):
|
||||
# FunctionExecuted(ctx.message.author, ctx.command)
|
||||
# await ctx.send(file=discord.File("./pictures/aqua.jpg"))
|
||||
#
|
||||
#read a file
|
||||
#@bot.command()
|
||||
#async def fetchtext(ctx):
|
||||
# FunctionExecuted(ctx.message.author, ctx.command)
|
||||
# text = open("docs/test.txt", encoding="utf-8").read()
|
||||
# await ctx.send(text)
|
||||
|
||||
###############
|
||||
### RUN BOT ###
|
||||
###############
|
||||
|
||||
bot.run(token)
|
||||
@@ -1,229 +0,0 @@
|
||||
#################################
|
||||
### AquaBot created by MarcMK ###
|
||||
### Project started ###
|
||||
### on 17.09.2019 ###
|
||||
### Aqua Best Girl! ###
|
||||
#################################
|
||||
|
||||
# This project uses discordpy
|
||||
# https://discordpy.readthedocs.io/en/latest/intro.html
|
||||
|
||||
###############
|
||||
### IMPORTS ###
|
||||
###############
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.utils import get
|
||||
|
||||
import logging
|
||||
import random
|
||||
import os.path
|
||||
|
||||
# https://github.com/Giphy/giphy-python-client#installation--usage
|
||||
# pip install giphy_client
|
||||
import giphy_client
|
||||
from giphy_client.rest import ApiException
|
||||
|
||||
# ffmpeg - still unused
|
||||
# youtube_dl - still unused
|
||||
|
||||
#################
|
||||
### CONSTANTS ###
|
||||
#################
|
||||
|
||||
BOT_TOKEN = ""
|
||||
GIPHY_API_TOKEN = ""
|
||||
|
||||
COMMAND_PREFIX = "."
|
||||
|
||||
####################
|
||||
### INITIALIZERS ###
|
||||
####################
|
||||
|
||||
bot = commands.Bot(command_prefix = ".")
|
||||
bot.remove_command("help")
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logging.basicConfig(level=logging.CRITICAL)
|
||||
|
||||
##############
|
||||
### EVENTS ###
|
||||
##############
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
name = f"Hentai | {COMMAND_PREFIX}aquabot"
|
||||
activity = discord.Activity(name=name, type=discord.ActivityType.watching)
|
||||
await bot.change_presence(activity=activity)
|
||||
print(f"AquaBot is ready!\n")
|
||||
|
||||
# TODO don't use hardcoded channel id
|
||||
@bot.event
|
||||
async def on_member_join(member):
|
||||
text = f"Welcome {member.mention} to our Discord! I am the usele... divine AquaBot!"
|
||||
channel = bot.get_channel(541637988120133634)
|
||||
await channel.send(text)
|
||||
|
||||
############
|
||||
### HELP ###
|
||||
############
|
||||
|
||||
@bot.command(aliases=["aquabot"])
|
||||
async def help(ctx):
|
||||
embed_help = discord.Embed(colour = discord.Colour.blue())
|
||||
text = f"""
|
||||
All commands were split up into these categories.\n
|
||||
For furter explanation, use e.g. `{COMMAND_PREFIX}commands general`\n
|
||||
"""
|
||||
|
||||
embed_help.add_field(name="I'm the usele... divine AquaBot!", value=text, inline=False)
|
||||
|
||||
# All inline=true, so the arrangement is responsive
|
||||
embed_help.add_field(name="• General", value="Guess what...", inline=True)
|
||||
embed_help.add_field(name="• Media", value="Sounds, GIFS, ...", inline=True)
|
||||
embed_help.add_field(name="• Axisbot", value="Praaaay!", inline=True)
|
||||
embed_help.add_field(name="• Waifu", value="Best Girl Stuff", inline=True)
|
||||
embed_help.add_field(name="• Steam", value="Configs, Profiles, ...", inline=True)
|
||||
embed_help.add_field(name="• Support", value="Need even more help?", inline=True)
|
||||
|
||||
link = "https://external-preview.redd.it/9n8rYQUzOck_C54YtzXt8qOFW_rY71-AZZHljtj14qw.jpg?auto=webp&s=aad1bc4546806bc435da29e4502e10442f298f2f"
|
||||
embed_help.set_footer(text="AquaBot made by MarcMK.", icon_url=link)
|
||||
await ctx.send(embed=embed_help)
|
||||
|
||||
@bot.command()
|
||||
async def commands(ctx, command):
|
||||
# All available command-groups
|
||||
command_list = [
|
||||
"general",
|
||||
"media",
|
||||
"axisbot",
|
||||
"waifu",
|
||||
"steam",
|
||||
"support"
|
||||
]
|
||||
|
||||
if command in command_list:
|
||||
embed_commands = discord.Embed(colour = discord.Colour.blue())
|
||||
|
||||
general = f"""
|
||||
`{COMMAND_PREFIX}aquabot`\n
|
||||
`{COMMAND_PREFIX}useless`\n
|
||||
`{COMMAND_PREFIX}pat [@target]`\n
|
||||
`{COMMAND_PREFIX}invitelink`\n
|
||||
`{COMMAND_PREFIX}boost`\n
|
||||
`{COMMAND_PREFIX}senpainoticeme`\n
|
||||
`{COMMAND_PREFIX}maddlesticks`\n
|
||||
`{COMMAND_PREFIX}flame [@target_name]`\n
|
||||
"""
|
||||
|
||||
media = f"""
|
||||
`{COMMAND_PREFIX}gif [tag]`\n
|
||||
`{COMMAND_PREFIX}listgif`\n
|
||||
`{COMMAND_PREFIX}join`\n
|
||||
`{COMMAND_PREFIX}leave`\n
|
||||
`{COMMAND_PREFIX}play [file]`\n
|
||||
"""
|
||||
|
||||
axisbot = f"""
|
||||
`{COMMAND_PREFIX}axisbot`\n
|
||||
`{COMMAND_PREFIX}pray`\n
|
||||
"""
|
||||
|
||||
waifu = f"""
|
||||
`{COMMAND_PREFIX}waifuwar [waifu] [waifu]`\n
|
||||
`{COMMAND_PREFIX}waifupicture`\n
|
||||
"""
|
||||
|
||||
steam = f"""
|
||||
`{COMMAND_PREFIX}steam [name]`\n
|
||||
`{COMMAND_PREFIX}steamid [id]`\n
|
||||
`{COMMAND_PREFIX}marcconfig`\n
|
||||
"""
|
||||
|
||||
support = "`WIP!`"
|
||||
|
||||
name = f"""
|
||||
Here are all commands from `{command}`\n
|
||||
Pro tip: The argument `list` shows all possible arguments from a command.
|
||||
"""
|
||||
|
||||
# TODO does value=command work here?
|
||||
embed_commands.add_field(name=name, value=command, inline=True)
|
||||
|
||||
await ctx.send(embed=embed_commands)
|
||||
|
||||
else:
|
||||
await ctx.send("> Categorie not found!")
|
||||
|
||||
########################
|
||||
### GENERAL COMMANDS ###
|
||||
########################
|
||||
|
||||
# Prints a random string to the text-channel
|
||||
@bot.command()
|
||||
async def useless(ctx):
|
||||
responses = [
|
||||
"I'm not useless!",
|
||||
"You're useless!",
|
||||
"Megumin is more useless!"
|
||||
]
|
||||
await ctx.send(f"> {random.choice(responses)}")
|
||||
|
||||
# Pats the specified user
|
||||
@bot.command()
|
||||
async def pat(ctx, target):
|
||||
if target == "noel" or target == "Noel":
|
||||
await ctx.send("> NNN-GYAAAAAAA!")
|
||||
else:
|
||||
response = f"{ctx.message.author.mention} has patted {target}"
|
||||
await ctx.send(response)
|
||||
|
||||
# Sends Discord Invitelink to Channel
|
||||
@bot.command(aliases=["invitelink"])
|
||||
async def invite_link(ctx):
|
||||
response = "Here is our invite link: https://discordapp.com/invite/HbYfyJT"
|
||||
await ctx.send(f"> {response}")
|
||||
|
||||
# Prints an Issei reference
|
||||
|
||||
@bot.command()
|
||||
async def boost(ctx):
|
||||
response = """
|
||||
BOOST! BOOST! BOOST! 🐲🐉\n
|
||||
Wait, this isn't my text...
|
||||
"""
|
||||
await ctx.send(f">>> {response}")
|
||||
|
||||
@bot.command()
|
||||
async def senpainoticeme(ctx):
|
||||
file = "./pictures/lorgst.png"
|
||||
file_exists = os.path.isfile(file)
|
||||
if file_exists:
|
||||
await ctx.send(file=discord.File(file))
|
||||
else:
|
||||
await ctx.send("Error opening the file! Maybe it doesn't exist?")
|
||||
|
||||
@bot.command()
|
||||
async def maddlesticks(ctx):
|
||||
file = "./pictures/fiddlesticksmarc.png"
|
||||
file_exists = os.path.isfile(file)
|
||||
if file_exists:
|
||||
await ctx.send(file=discord.File(file))
|
||||
else:
|
||||
await ctx.send("Error opening the file! Maybe it doesn't exist?")
|
||||
|
||||
# Flames a player
|
||||
@bot.command()
|
||||
async def flame(ctx, username):
|
||||
insult_list = [
|
||||
"is useless!",
|
||||
"is worthless!"
|
||||
]
|
||||
response = f"{username} {random.choice(insult_list)}"
|
||||
await ctx.send(f"> {response}")
|
||||
|
||||
######################
|
||||
### Media Commands ###
|
||||
######################
|
||||
Reference in New Issue
Block a user