1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Rename bot to client

This commit is contained in:
Steffo 2019-04-19 02:32:12 +02:00
parent db1f1ded12
commit 350d754683
3 changed files with 8 additions and 8 deletions

View file

@ -155,9 +155,9 @@ class DiscordBot(GenericBot):
return DiscordClient return DiscordClient
def _init_bot(self): def _init_client(self):
"""Create a bot instance.""" """Create a bot instance."""
self.bot = self._bot_factory()() self.client = self._bot_factory()()
def __init__(self, *, def __init__(self, *,
discord_config: DiscordConfig, discord_config: DiscordConfig,
@ -172,12 +172,12 @@ class DiscordBot(GenericBot):
missing_command=missing_command, missing_command=missing_command,
error_command=error_command) error_command=error_command)
self._discord_config = discord_config self._discord_config = discord_config
self._init_bot() self._init_client()
self._init_voice() self._init_voice()
async def run(self): async def run(self):
await self.bot.login(self._discord_config.token) await self.client.login(self._discord_config.token)
await self.bot.connect() await self.client.connect()
# TODO: how to stop? # TODO: how to stop?
# class DiscordBot: # class DiscordBot:

View file

@ -25,7 +25,7 @@ class PlayNH(NetworkHandler):
"""Handle a play Royalnet request. That is, add audio to a PlayMode.""" """Handle a play Royalnet request. That is, add audio to a PlayMode."""
# Find the matching guild # Find the matching guild
if message.guild_identifier: if message.guild_identifier:
guild = bot.find_guild(message.guild_identifier) guild = bot.client.find_guild(message.guild_identifier)
else: else:
if len(bot.music_data) != 1: if len(bot.music_data) != 1:
raise TooManyFoundError("Multiple guilds found") raise TooManyFoundError("Multiple guilds found")

View file

@ -24,10 +24,10 @@ class SummonNH(NetworkHandler):
@classmethod @classmethod
async def discord(cls, bot: "DiscordBot", message: SummonMessage): 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.""" """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): if not isinstance(channel, discord.VoiceChannel):
raise NoneFoundError("Channel is not a voice channel") 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() return RequestSuccessful()