The KISS Twitch bot
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

60 rindas
1.6 KiB

  1. #!/usr/bin/env python3
  2. # Twason - The KISS Twitch bot
  3. # Copyright (C) 2021 Jérôme Deuchnord
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU Affero General Public License as
  7. # published by the Free Software Foundation, either version 3 of the
  8. # License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Affero General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License
  16. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. import argparse
  18. import irc3
  19. from _twitchbot.config import get_config
  20. from _twitchbot import twitchbot
  21. TWITCH_IRC_SERVER = "irc.chat.twitch.tv"
  22. TWITCH_IRC_PORT = 6697
  23. def main() -> int:
  24. args = get_arguments()
  25. twitchbot.config = get_config(args.config)
  26. print(twitchbot.config.timer.messages)
  27. bot = irc3.IrcBot.from_config({
  28. 'nick': twitchbot.config.nickname,
  29. 'password': twitchbot.config.token,
  30. 'autojoins': [twitchbot.config.channel],
  31. 'host': TWITCH_IRC_SERVER,
  32. 'port': TWITCH_IRC_PORT,
  33. 'ssl': True,
  34. 'includes': [twitchbot.__name__]
  35. })
  36. bot.run(forever=True)
  37. return 0
  38. def get_arguments():
  39. parser = argparse.ArgumentParser()
  40. parser.add_argument('--config', '-c', type=str, default='config.json')
  41. return parser.parse_args()
  42. if __name__ == '__main__':
  43. exit(main())