From 87c67d42808076704d8cb9fb8e54cd4d4eacca6f Mon Sep 17 00:00:00 2001 From: Akumatic Date: Tue, 1 Oct 2019 01:33:50 +0200 Subject: [PATCH] Rework of Bot: README updated --- README.md | 71 ++++++++++--------------------------------------------- 1 file changed, 12 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 1a9b52b..1ac30b4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Akuma Matata -A Discord Bot written in Python using the Rewrite API wrapper +A Discord Bot written in Python using the Rewrite API Wrapper ## Getting Started @@ -17,10 +17,8 @@ Depending on your OS and environment you need to type `python3` or another equiv 1. Go to [your Discord's App Overview](https://discordapp.com/developers/applications/me) and create a new app. 2. Scroll down and "Create a Bot User" 3. Reveal and copy Token of your new Bot -4. Open [settings.json](settings.json) and paste your Token into the quotes after `"token":` -5. Open Discord, enable Developer Mode (Settings > Appearance) and copy your own ID -6. Open [settings.json](settings.json) and paste your ID into the quotes after `"maintainer":` -6. Start the Bot (see below) +4. Start the Bot (see below) +5. The Bot will ask you for the Token. Paste it. 7. Go to [your Discord's App Overview](https://discordapp.com/developers/applications/me) again and open the Bot 8. Click on "Generate OAuth2 URL" and give the bot `Administrator` Bot Permissions 9. Open the generated URL and add the Bot to your Server @@ -32,59 +30,8 @@ Depending on your OS and environment you need to type `python3` or another equiv ### Configuration -In your bot folder are two configuration files: `settings.json` and `server.json`. - -##### settings.json - -- `token` - -The bot token your bot is using. - -- `prefix` - -The bot needs a prefix to distinguish messages adressed to him. - -- `description` - -A description of the bot, printed when calling `help`. - -- `game` - -Sets the "Playing" message of your bot, placed after a help command - -- `extensions` - -A list of all extensions the bot will automatically load after starting. You can add more members either manually or by passing `True` as second argument to `load ` - -- `maintainer` - -ID of the user with privileges to maintain the bot. Only this user can load, unload and reload extensions. - -##### server.json -*You can either edit this file manually or use the respective moderation commands.* - -As soon as the bot joins a server, it will fill `server.json` automatically with an dictionary identified by the server ID with the following keys: - -- `adminRole` - -Everyone with the given role has the permissions to run admin commands of the bot - -- `modRole` - -Everyone with the given role has the permissions to run mod commands of the bot - -- `joinMessage` - -A Message every user gets when he joins your server. - -- `suggestionChannel` - -A designated channel for the bot's suggest function. See `help suggest` for more informations - -- `modChannel` - -A channel the bot is using for logging moderation commands. +The configuration files for the bot are now stored in %APPDATA%, $XDG_CONFIG_HOME or ~/.config. The specific directory for these files is `Akumatic/Akuma-Matata`. However is a direct interaction with them not necessary anymore. ## Add your own extensions @@ -92,7 +39,9 @@ It is easy to create a new extension on your own. First you need to create a new You'll need this code in the newly created file: ``` -class Name(): +from discord.ext import commands + +class Name(commands.Cog): def __init__(self, bot): self.bot = bot @@ -107,11 +56,15 @@ Instead of using `@bot.command()` you'll need to use `@commands.command()`. The first argument of a method needs to be `self`. +After implementing all your functions, you just need to load the extension with the following command in any channel your bot can listen to: `load ` + +If you add `true`to your command, the extension will be added to your configuration files and gets automatically loaded on start. + ##### An Example: ``` from discord.ext import commands -class PingPong(): +class PingPong(commands.Cog): def __init__(self, bot): self.bot = bot