webexmemebot/app/main.py

45 lines
1001 B
Python
Raw Normal View History

2023-07-21 23:57:14 +02:00
#!/usr/local/bin/python3
2024-04-21 18:20:58 +02:00
import sentry_sdk
from sentry_sdk.integrations.stdlib import StdlibIntegration
2023-07-21 23:57:14 +02:00
from webex_bot.webex_bot import WebexBot
2023-12-14 21:55:17 +01:00
from app import close, meme
2024-04-21 18:20:58 +02:00
from app.config import config
2023-07-21 23:57:14 +02:00
2024-04-21 18:20:58 +02:00
if config.sentry_enabled:
apm = sentry_sdk.init(
dsn=config.sentry_dsn,
enable_tracing=True,
environment=config.environment,
release=config.version,
integrations=[StdlibIntegration()],
spotlight=True
)
2023-07-21 23:57:14 +02:00
def create_bot() -> WebexBot:
"""Create a Bot object."""
bot = WebexBot(
2024-04-21 18:20:58 +02:00
teams_bot_token=config.webex_token,
2023-07-21 23:57:14 +02:00
approved_domains=["cisco.com"],
bot_name="MemeBot",
include_demo_commands=False,
)
return bot
2023-07-24 17:16:30 +02:00
def main() -> None:
2023-07-21 23:57:14 +02:00
bot: WebexBot = create_bot()
bot.add_command(meme.MakeMemeCommand())
2023-07-24 17:16:30 +02:00
bot.add_command(close.ExitCommand())
2023-07-21 23:57:14 +02:00
bot.commands.remove(bot.help_command)
bot.help_command = meme.MakeMemeCommand()
bot.run()
if __name__ == "__main__":
main()