diff options
-rwxr-xr-x | cogs/admin.py | 13 | ||||
-rw-r--r-- | readme.md | 24 |
2 files changed, 29 insertions, 8 deletions
diff --git a/cogs/admin.py b/cogs/admin.py index 1623f49..9fbc6e1 100755 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -57,7 +57,7 @@ class Admin(commands.Cog): """Reloads an extension""" try: self.bot.reload_extension(f'cogs.{ext}') - await ctx.send(f'The extension {ext} was realoaded!') # Oceanlight told me too + await ctx.send(f'The extension {ext} was reloaded!') except commands.ExtensionNotFound: await ctx.send(f'The extension {ext} doesn\'t exist.') except commands.ExtensionNotLoaded: @@ -203,11 +203,12 @@ class Admin(commands.Cog): @commands.check(is_mod) @commands.command() async def setvar(self, ctx, key, *, value): - with open('config.json', 'w') as f: - if value[0] == '[' and value[len(value)-1] == ']': - value = list(map(int, value[1:-1].split(','))) - self.bot.config[str(ctx.message.guild.id)][key] = value - json.dump(self.bot.config, f, indent=4) + if ctx.author.id in self.bot.config[str(ctx.message.guild.id)]["bot_masters"]: + with open('config.json', 'w') as f: + if value[0] == '[' and value[len(value)-1] == ']': + value = list(map(int, value[1:-1].split(','))) + self.bot.config[str(ctx.message.guild.id)][key] = value + json.dump(self.bot.config, f, indent=4) @commands.check(is_mod) @commands.command() @@ -1,8 +1,28 @@ # Minecraft Bedrock Discord Bot ## How to -Make a file called `config.py` and add a `token="DiscordToken"` variable in there. +Make a file called `config.json` and add +```json +{ + "token": "your_bot_token" +} +``` + Launch the bot with `python3 main.py` and you're ready to go. Unless dependencies. Dependencies are google cloud and discord. -This bot was built as a fork of [celesteBot](https://github.com/CelesteClassic/celestebot), so a lot of code is recycled. +Install the dependencies with `python -m pip install -r requirements.txt` + +A few "dangerous" commands such as `!purge` are restriced to `bot_masters`, to add a bot master add it to `config.json`. Example: +```json +{ + "token": "your_bot_token", + "bot_masters": <users_discord_id> +} +``` +You can also use lists, for example: `"bot_masters": [280428276810383370, 99457716614885376]` + +A user added as a botmaster will be able to edit the config via discord with the command `!setvar <var_name> <var_value>` +`!setvar` also supports lists which can be added like so: `!setvar <var_name> [<index 0>, <index 1>]` + +This bot was built as a fork of [celesteBot](https://github.com/CelesteClassic/celestebot), so a lot of code is recycled. Feel free to make a pull request or use the code here. |