예제 #1
0
    def __init__(self, bot):
        self.bot = bot
        self.info = Info.ServerInformation("Data Files/server_info.json")

        with open("Data Files/wen.json") as f:
            self.wen = json.load(f)

        self.wen_lock = asyncio.Lock()

        self.counter = {}
        self.counter_locks = {}

        for channel in self.info.server_info["scam_channels"]:
            self.counter[channel] = 0
            self.counter_locks[channel] = asyncio.Lock()

        self.board_lock = asyncio.Lock()
        self.white_list_lock = asyncio.Lock()

        client = self.info.server_info["twitch_client"]
        sec = self.info.server_info["twitch_secret"]

        response = requests.post(f"https://id.twitch.tv/oauth2/token"
                                 f"?client_id={client}"
                                 f"&client_secret={sec}"
                                 "&grant_type=client_credentials")

        if response.status_code == 200:
            self.bearer_token = response.json()['access_token']

            self.headers = {
                "client-id": self.info.server_info["twitch_client"],
                "Authorization": "Bearer " + self.bearer_token
            }

        self.notify_channels = self.info.server_info["twtich_watchlist"]
        self.notify_times = {}
        self.notify_times_lock = {}

        for i in self.notify_channels:
            self.notify_times[i] = {}
            self.notify_times[i]["time-last-online"] = np.inf
            self.notify_times[i]["already-notified"] = False
예제 #2
0
 def __init__(self, bot):
     self.bot = bot
     self.info = Info.ServerInformation("Data Files/server_info.json")
     self.coin = CoinInfo.CoinQuery()
예제 #3
0
 def __init__(self):
     self.bot = commands.Bot(command_prefix='$')
     self.info = Info.ServerInformation("Data Files/server_info.json")