The KISS Twitch bot
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

59 Zeilen
1.5 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. bot = irc3.IrcBot.from_config({
  27. 'nick': twitchbot.config.nickname,
  28. 'password': twitchbot.config.token,
  29. 'autojoins': [],
  30. 'host': TWITCH_IRC_SERVER,
  31. 'port': TWITCH_IRC_PORT,
  32. 'ssl': True,
  33. 'includes': [twitchbot.__name__]
  34. })
  35. bot.run(forever=True)
  36. return 0
  37. def get_arguments():
  38. parser = argparse.ArgumentParser()
  39. parser.add_argument('--config', '-c', type=str, default='config.json')
  40. return parser.parse_args()
  41. if __name__ == '__main__':
  42. exit(main())