def add_sound(self, ctx, source, sourcetype):
""" Add a sound to a bot's queue. """
if ctx.message.author.voice == None:
await ctx.send("You're not in a voice channel!")
else:
# Check if any bots in guild. Warn user if not.
# TODO: Move to Bot Manager.
for helper in self.bot.helperList:
if helper.is_in_guild(ctx.guild):
break
else:
await ctx.send("No helper bots in this server. Do !invite to add them.")
return
vchan_id = ctx.message.author.voice.channel.id
sound = await self.parse_sound(source, sourcetype)
# Find a bot and add to its queue.
helper = self.choose_helper(vchan_id)
if helper != None:
await helper.queue_sound(vchan_id, sound)
await ctx.send("Queueing sound!")
else:
await ctx.send("Sorry, there are no available bots!")
评论列表
文章目录