update
This commit is contained in:
24
TwitchChannelPointsMiner/classes/Discord.py
Normal file
24
TwitchChannelPointsMiner/classes/Discord.py
Normal file
@ -0,0 +1,24 @@
|
||||
from textwrap import dedent
|
||||
|
||||
import requests
|
||||
|
||||
from TwitchChannelPointsMiner.classes.Settings import Events
|
||||
|
||||
|
||||
class Discord(object):
|
||||
__slots__ = ["webhook_api", "events"]
|
||||
|
||||
def __init__(self, webhook_api: str, events: list):
|
||||
self.webhook_api = webhook_api
|
||||
self.events = [str(e) for e in events]
|
||||
|
||||
def send(self, message: str, event: Events) -> None:
|
||||
if str(event) in self.events:
|
||||
requests.post(
|
||||
url=self.webhook_api,
|
||||
data={
|
||||
"content": dedent(message),
|
||||
"username": "Twitch Channel Points Miner",
|
||||
"avatar_url": "https://i.imgur.com/X9fEkhT.png",
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user