2021-11-16 05:13:43 +00:00
|
|
|
import requests
|
|
|
|
|
2020-12-30 22:49:32 +00:00
|
|
|
from wowstash.models import Event
|
|
|
|
from wowstash.factory import db
|
2021-11-16 05:13:43 +00:00
|
|
|
from wowstash import config
|
2020-12-30 22:49:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|