forked from sigpwny/ctfd-discord-webhook-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
37 lines (30 loc) · 1.63 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from os import environ
def config(app):
'''
Discord webhook URL to send data to. Set to None to disable plugin entirely.
'''
app.config['DISCORD_WEBHOOK_URL'] = environ.get('DISCORD_WEBHOOK_URL')
'''
Limit on number of solves for challenge to trigger webhook for. Set to 0 to send a message for every solve.
'''
app.config['DISCORD_WEBHOOK_LIMIT'] = environ.get('DISCORD_WEBHOOK_LIMIT', '3')
'''
Webhook flag submission format string. Valid vars: team, user, solves, fsolves (formatted solves), challenge, category, team_id, user_id, challenge_slug, value
'''
app.config['DISCORD_WEBHOOK_MESSAGE'] = environ.get('DISCORD_WEBHOOK_MESSAGE', 'Congratulations to team {team} for the {fsolves} solve on challenge {challenge}!')
'''
Post webhook message when challenge is changed (published, hidden or updated)
'''
app.config['DISCORD_WEBHOOK_CHALL'] = environ.get('DISCORD_WEBHOOK_CHALL', True)
'''
Post webhook message when challenge is updated (otherwise only published or hidden)
'''
app.config['DISCORD_WEBHOOK_CHALL_UPDATE'] = environ.get('DISCORD_WEBHOOK_CHALL_UPDATE', False)
'''
Post webhook message even if challenge has not yet been published (only relevant when update is enabled)
'''
app.config['DISCORD_WEBHOOK_CHALL_UNPUBLISHED'] = environ.get('DISCORD_WEBHOOK_CHALL_UNPUBLISHED', False)
'''
Webhook challenge change format string. Valid vars: challenge, category, action (published, hidden or updated)
'''
app.config['DISCORD_WEBHOOK_CHALL_MESSAGE'] = environ.get('DISCORD_WEBHOOK_CHALL_MESSAGE', 'Challenge {challenge} has been {action}!')