wowstash/wowstash/library/helpers.py

24 lines
479 B
Python
Raw Permalink Normal View History

2021-11-16 05:13:43 +00:00
import requests
from wowstash.models import Event
from wowstash.factory import db
2021-11-16 05:13:43 +00:00
from wowstash import config
def capture_event(user_id, event_type):
event = Event(
user=user_id,
type=event_type
)
db.session.add(event)
db.session.commit()
return
2021-11-16 05:13:43 +00:00
def post_discord_webhook(text):
try:
r = requests.post(config.DISCORD_URL, data={"content": text})
r.raise_for_status()
return True
except:
return False