1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 14:27:27 +00:00

"Added prefix to config and fixed initial startup"

This commit is contained in:
Myned 2017-09-24 15:13:36 -04:00
parent 9f774d8ebb
commit bb3721478f
2 changed files with 8 additions and 8 deletions

View file

@ -395,7 +395,7 @@ class MsG:
@commands.is_owner()
async def __clear_global_blacklist(self, ctx):
global global_blacklist
global_blacklist = []
del global_blacklist
with open('global_blacklist.json', 'w') as outfile:
json.dump(global_blacklist, outfile, indent=4, sort_keys=True)
await ctx.send('✅ **Global blacklist cleared.**', delete_after=5)
@ -408,7 +408,7 @@ class MsG:
else:
guild = ctx.message.channel
channel = ctx.message.channel
guild_blacklist.get(str(guild.id), {})[str(channel.id)] = []
del guild_blacklist.get(str(guild.id), {})[str(channel.id)]
with open('guild_blacklist.json', 'w') as outfile:
json.dump(guild_blacklist, outfile, indent=4, sort_keys=True)
await ctx.send('✅ <#' + str(channel.id) + '> **blacklist cleared.**', delete_after=5)
@ -416,7 +416,7 @@ class MsG:
async def __clear_user_blacklist(self, ctx):
global user_blacklist
user = ctx.message.author
user_blacklist[str(user.id)] = []
del user_blacklist[str(user.id)]
with open('user_blacklist.json', 'w') as outfile:
json.dump(user_blacklist, outfile, indent=4, sort_keys=True)
await ctx.send('' + user.mention + '**\'s blacklist cleared.**', delete_after=5)

View file

@ -6,7 +6,7 @@ try:
print('\"config.json\" loaded.')
except FileNotFoundError:
with open('config.json', 'w') as outfile:
json.dump({'client_id': 0, 'owner_id': 0, 'permissions': 0, 'shutdown_channel': 0, 'startup_channel': 0, 'token': 'str'}, outfile, indent=4, sort_keys=True)
json.dump({'client_id': 0, 'owner_id': 0, 'permissions': 388160, 'prefix': ',', 'shutdown_channel': 0, 'startup_channel': 0, 'token': 'str'}, outfile, indent=4, sort_keys=True)
raise FileNotFoundError('Config file not found: \"config.json\" created with abstract values. Restart \"run.py\" with correct values.')
import asyncio
@ -18,11 +18,12 @@ from cogs import booru, info, tools
from misc import checks
from misc import exceptions as exc
bot = commands.Bot(command_prefix=commands.when_mentioned_or(','), description='Experimental booru bot')
bot = commands.Bot(command_prefix=commands.when_mentioned_or(config['prefix']), description='Experimental booru bot')
# Send and print ready message to #testing and console after logon
@bot.event
async def on_ready():
if isinstance(bot.get_channel(config['startup_channel']), discord.TextChannel):
await bot.get_channel(config['startup_channel']).send('Hello how are? **Have day.** 🌈\n<embed>[STARTUP-INFO]</embed>')
print('Connected.')
print('Username: ' + bot.user.name)
@ -34,8 +35,7 @@ async def on_ready():
@commands.is_owner()
async def die(ctx):
try:
await ctx.send('Am go bye. **Have night.** 💤')
# await bot.get_channel(config['shutdown_channel']).send('<embed>[SHUTDOWN-INFO]</embed>')
await bot.get_channel(config['shutdown_channel']).send('Am go bye. **Have night.** 💤\n<embed>[SHUTDOWN-INFO]</embed>')
await bot.close()
print('-------')
print('Closed.')