master
Aevann1 2022-01-17 20:20:42 +02:00
parent a6bee8e260
commit 202c20a964
2 changed files with 33 additions and 0 deletions

View File

@ -463,6 +463,10 @@ BADGES = {
'name': 'Christmas 21',
'description': 'Awarded for surviving Fistmas 2021'
},
103: {
'name': 'Benefactor',
'description': 'Gave the Benefactor award to someone'
},
}
AWARDS = {
@ -682,6 +686,14 @@ AWARDS = {
"color": "text-success",
"price": 3500
},
"benefactor": {
"kind": "benefactor",
"title": "Benefactor",
"description": "Grants one month of paypig status and 2500 marseybux to the recipient. Cannot be used on yourself.",
"icon": "fas fa-gift",
"color": "text-purple",
"price": 4000
},
"grass": {
"kind": "grass",
"title": "Grass",

View File

@ -215,6 +215,10 @@ def award_post(pid, v):
send_repeatable_notification(post.author.id, msg)
author = post.author
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
if kind == "ban":
link = f"[this post]({post.permalink})"
@ -350,6 +354,13 @@ def award_post(pid, v):
badge = Badge(user_id=author.id, badge_id=94)
g.db.add(badge)
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "benefactor":
author.patron = 1
author.procoins += 2500
if not v.has_badge(103):
badge = Badge(user_id=v.id, badge_id=103)
g.db.add(badge)
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
if post.author.received_award_count: post.author.received_award_count += 1
else: post.author.received_award_count = 1
@ -403,6 +414,9 @@ def award_comment(cid, v):
author = c.author
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
if kind == "ban":
link = f"[this comment]({c.permalink})"
@ -535,6 +549,13 @@ def award_comment(cid, v):
badge = Badge(user_id=author.id, badge_id=94)
g.db.add(badge)
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "benefactor":
author.patron = 1
author.procoins += 2500
if not v.has_badge(103):
badge = Badge(user_id=v.id, badge_id=103)
g.db.add(badge)
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
if c.author.received_award_count: c.author.received_award_count += 1
else: c.author.received_award_count = 1