From 350d754683a20328663e919593a7b4f9febd263e Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 19 Apr 2019 02:32:12 +0200 Subject: [PATCH] Rename bot to client --- royalnet/bots/discord.py | 10 +++++----- royalnet/commands/play.py | 2 +- royalnet/commands/summon.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/royalnet/bots/discord.py b/royalnet/bots/discord.py index 958a082e..da51b9c5 100644 --- a/royalnet/bots/discord.py +++ b/royalnet/bots/discord.py @@ -155,9 +155,9 @@ class DiscordBot(GenericBot): return DiscordClient - def _init_bot(self): + def _init_client(self): """Create a bot instance.""" - self.bot = self._bot_factory()() + self.client = self._bot_factory()() def __init__(self, *, discord_config: DiscordConfig, @@ -172,12 +172,12 @@ class DiscordBot(GenericBot): missing_command=missing_command, error_command=error_command) self._discord_config = discord_config - self._init_bot() + self._init_client() self._init_voice() async def run(self): - await self.bot.login(self._discord_config.token) - await self.bot.connect() + await self.client.login(self._discord_config.token) + await self.client.connect() # TODO: how to stop? # class DiscordBot: diff --git a/royalnet/commands/play.py b/royalnet/commands/play.py index e74715f6..6f37d076 100644 --- a/royalnet/commands/play.py +++ b/royalnet/commands/play.py @@ -25,7 +25,7 @@ class PlayNH(NetworkHandler): """Handle a play Royalnet request. That is, add audio to a PlayMode.""" # Find the matching guild if message.guild_identifier: - guild = bot.find_guild(message.guild_identifier) + guild = bot.client.find_guild(message.guild_identifier) else: if len(bot.music_data) != 1: raise TooManyFoundError("Multiple guilds found") diff --git a/royalnet/commands/summon.py b/royalnet/commands/summon.py index 7aeb5eb5..dc301de0 100644 --- a/royalnet/commands/summon.py +++ b/royalnet/commands/summon.py @@ -24,10 +24,10 @@ class SummonNH(NetworkHandler): @classmethod async def discord(cls, bot: "DiscordBot", message: SummonMessage): """Handle a summon Royalnet request. That is, join a voice channel, or move to a different one if that is not possible.""" - channel = bot.find_channel(message.channel_identifier) + channel = bot.client.find_channel(message.channel_identifier) if not isinstance(channel, discord.VoiceChannel): raise NoneFoundError("Channel is not a voice channel") - loop.create_task(bot.bot.vc_connect_or_move(channel)) + loop.create_task(bot.client.vc_connect_or_move(channel)) return RequestSuccessful()