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:
parent
db1f1ded12
commit
350d754683
3 changed files with 8 additions and 8 deletions
|
@ -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:
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue