-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcfg.py
40 lines (32 loc) · 1.12 KB
/
cfg.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
import os
import random
import traceback
import asyncio
import discord
from discord.ext import commands
import utils.json_loader
class Config(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(
name="prefix",
aliases=["changeprefix", "setprefix"],
description="Change your guilds prefix!",
usage="[prefix]",
)
@commands.has_guild_permissions(manage_guild=True)
async def prefix(self, ctx, *, prefix="py."):
await self.bot.config.upsert({"_id": ctx.guild.id, "prefix": prefix})
await ctx.send(
f"The guild prefix has been set to `{prefix}`. Use `{prefix}prefix [prefix]` to change it again!"
)
@commands.command(
name="deleteprefix", aliases=["dp"], description="Delete your guilds prefix!"
)
@commands.guild_only()
@commands.has_guild_permissions(administrator=True)
async def deleteprefix(self, ctx):
await self.bot.config.unset({"_id": ctx.guild.id, "prefix": 1})
await ctx.send("This guilds prefix has been set back to the default")
def setup(bot):
bot.add_cog(Config(bot))