Update for rewrite: Batch 3
This commit is contained in:
parent
a05b768274
commit
3543d205f2
4
bot.py
4
bot.py
|
@ -94,10 +94,10 @@ async def on_command_error(error, ctx):
|
|||
|
||||
if isinstance(error, commands.BadArgument):
|
||||
fmt = "Please provide a valid argument to pass to the command: {}".format(error)
|
||||
await bot.send_message(ctx.message.channel, fmt)
|
||||
await ctx.message.channel.send(fmt)
|
||||
elif isinstance(error, commands.CheckFailure):
|
||||
fmt = "You can't tell me what to do!"
|
||||
await bot.send_message(ctx.message.channel, fmt)
|
||||
await ctx.message.channel.send(fmt)
|
||||
elif isinstance(error, commands.CommandOnCooldown):
|
||||
m, s = divmod(error.retry_after, 60)
|
||||
fmt = "This command is on cooldown! Hold your horses! >:c\nTry again in {} minutes and {} seconds" \
|
||||
|
|
|
@ -30,7 +30,7 @@ class Music:
|
|||
|
||||
@commands.command(no_pm=True, enabled=False)
|
||||
@checks.custom_perms(send_messages=True)
|
||||
async def join(self, ctx, *, channel: discord.Channel):
|
||||
async def join(self, ctx, *, channel: discord.TextChannel):
|
||||
"""Joins a voice channel.
|
||||
|
||||
EXAMPLE: !join Music
|
||||
|
|
|
@ -101,7 +101,7 @@ class Mod:
|
|||
|
||||
@commands.command(no_pm=True)
|
||||
@utils.custom_perms(kick_members=True)
|
||||
async def alerts(self, ctx, channel: discord.Channel):
|
||||
async def alerts(self, ctx, channel: discord.TextChannel):
|
||||
"""This command is used to set a channel as the server's 'notifications' channel
|
||||
Any notifications (like someone going live on Twitch, or Picarto) will go to that channel
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ class Music:
|
|||
|
||||
@commands.command(no_pm=True)
|
||||
@utils.custom_perms(send_messages=True)
|
||||
async def join(self, *, channel: discord.Channel):
|
||||
async def join(self, *, channel: discord.TextChannel):
|
||||
"""Joins a voice channel."""
|
||||
try:
|
||||
await self.create_voice_client(channel)
|
||||
|
|
|
@ -9,7 +9,7 @@ global_config = {}
|
|||
# Ensure that the required config.yml file actually exists
|
||||
try:
|
||||
with open("config.yml", "r") as f:
|
||||
global_config = yaml.load(f)
|
||||
global_config = yaml.safe_load(f)
|
||||
except FileNotFoundError:
|
||||
print("You have no config file setup! Please use config.yml.sample to setup a valid config file")
|
||||
quit()
|
||||
|
@ -70,10 +70,6 @@ user_agent = global_config.get('user_agent', "")
|
|||
# The extensions to load
|
||||
extensions = global_config.get('extensions', [])
|
||||
|
||||
# The variables needed for sharding
|
||||
shard_count = global_config.get('shard_count', 1)
|
||||
shard_id = global_config.get('shard_id', 0)
|
||||
|
||||
# The default status the bot will use
|
||||
default_status = global_config.get("default_status", None)
|
||||
# The URL that will be used to link to for the help command
|
||||
|
@ -124,14 +120,9 @@ def command_prefix(bot, message):
|
|||
# But it is not worth a query for every single message the bot detects, to fix
|
||||
try:
|
||||
values = cache['prefixes'].values
|
||||
try:
|
||||
prefix = [data['prefix'] for data in values if message.server.id == data['server_id']][0]
|
||||
except IndexError:
|
||||
prefix = None
|
||||
except AttributeError:
|
||||
prefix = None
|
||||
prefix = [data['prefix'] for data in values if message.server.id == data['server_id']][0]
|
||||
return prefix or default_prefix
|
||||
except KeyError:
|
||||
except (KeyError, TypeError, IndexError, AttributeError):
|
||||
return default_prefix
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue