From 686746cd1f5acbbcfdd928692d9f9811530770b0 Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Sat, 30 Nov 2024 10:28:20 +0100 Subject: [PATCH] sasl authentication --- aoc_bot.py | 7 +++++++ config.example.json | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/aoc_bot.py b/aoc_bot.py index 5cdbee2..27de4fb 100644 --- a/aoc_bot.py +++ b/aoc_bot.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 import argparse import os.path +import time + import requests import sys from datetime import datetime, timedelta @@ -40,6 +42,10 @@ class AOCBot: self.__aoc_session_file = config["AOC"]["session_file"] self.__aoc_user_agent = config["AOC"]["user_agent"] self.__cache_file = config["AOC"]["cache_file"] + if "sasl_password" in config["IRC"]: + self.__sasl_password = config["IRC"]["sasl_password"] + else: + self.__sasl_password = None except AttributeError as e: print("CONFIGURATION ERROR: %s" % e) sys.exit(1) @@ -226,6 +232,7 @@ class AOCBot: nick=self.__irc_nick, username=self.__irc_user, realname=self.__irc_real_name, + sasl_password=self.__sasl_password, ) print("[AoCBot] Joining Channel %s" % self.__irc_channel) diff --git a/config.example.json b/config.example.json index cfa62a5..4fe1c83 100644 --- a/config.example.json +++ b/config.example.json @@ -11,7 +11,10 @@ // The Bots IRC identity "nick": "AoCBot", "user": "aucbot", - "name": "Advent of Code Leaderboard Announcer" + "name": "Advent of Code Leaderboard Announcer", + + // If your IRC server requires SASL authentication, set the password here, + "sasl_password": null }, "AOC": { // The content of your aoc session cookie should be stored in this file