config initialization
This commit is contained in:
parent
25bc1f21c0
commit
fdd2aed0b8
|
|
@ -28,6 +28,17 @@ class DiscordBotPlugin(PHALPlugin):
|
||||||
self.bus.on("configuration.updated", self.init_configuration)
|
self.bus.on("configuration.updated", self.init_configuration)
|
||||||
reinstall_hint = "pip install --upgrade --no-deps --force-reinstall git+https://git.sebastianmaki.fi/sebastian/ovos-PHAL-plugin-discord-bot.git"
|
reinstall_hint = "pip install --upgrade --no-deps --force-reinstall git+https://git.sebastianmaki.fi/sebastian/ovos-PHAL-plugin-discord-bot.git"
|
||||||
LOG.info(f"Reinstall hint: {reinstall_hint}")
|
LOG.info(f"Reinstall hint: {reinstall_hint}")
|
||||||
|
# Discord event: bot is ready
|
||||||
|
@self.bot.event
|
||||||
|
async def on_ready():
|
||||||
|
myLoop.start()
|
||||||
|
print(f'{bot.user} has connected to Discord!')
|
||||||
|
|
||||||
|
admin = await get_discord_user_by_id(DISCORD_ADMIN_ID)
|
||||||
|
if admin:
|
||||||
|
print(f"Admin is {admin.name}")
|
||||||
|
await admin.send("I'm now online")
|
||||||
|
|
||||||
self.setup_configuration()
|
self.setup_configuration()
|
||||||
|
|
||||||
@classproperty
|
@classproperty
|
||||||
|
|
@ -96,3 +107,7 @@ class DiscordBotPlugin(PHALPlugin):
|
||||||
self.bot.run(self.api_token)
|
self.bot.run(self.api_token)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Helper function to get Discord user by ID
|
||||||
|
async def get_discord_user_by_id(user_id) -> discord.User:
|
||||||
|
return await self.bot.fetch_user(user_id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue