add !followers

master
Aevann 2023-08-11 16:34:56 +03:00
parent 166f6fb4ee
commit 5eb2c0dc27
3 changed files with 9 additions and 4 deletions

View File

@ -164,7 +164,9 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None):
elif i.group(1) == 'jannies':
group = None
member_ids = set([x[0] for x in g.db.query(User.id).filter(User.admin_level > 0, User.id != AEVANN_ID)])
coin_receivers.update(member_ids)
elif i.group(1) == 'followers':
group = None
member_ids = set([x[0] for x in g.db.query(Follow.user_id).filter_by(target_id=v.id)])
else:
group = g.db.get(Group, i.group(1))
if not group: continue
@ -174,7 +176,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None):
notify_users.update(members)
if ghost or v.id not in member_ids:
if (ghost or v.id not in member_ids) and i.group(1) != 'followers':
if group and group.name == 'verifiedrich':
abort(403, f"Only !verifiedrich members can mention it!")
cost += len(members) * 10
@ -184,7 +186,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None):
if log_cost:
log_cost.ping_cost = cost
if group and group.name in {'biofoids','neofoids'}:
if i.group(1) in {'biofoids','neofoids','jannies'}:
coin_receivers.update(member_ids)
if cost:

View File

@ -18,6 +18,7 @@ from files.classes.domains import BannedDomain
from files.classes.mod_logs import ModAction
from files.classes.notifications import Notification
from files.classes.group import Group
from files.classes.follows import Follow
from files.helpers.config.const import *
from files.helpers.const_stateful import *
@ -487,6 +488,8 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
return f'<a href="/users">!{name}</a>'
elif name == 'jannies':
return f'<a href="/admins">!{name}</a>'
elif name == 'followers':
return f'<a href="/id/{g.v.id}/followers">!{name}</a>'
elif g.db.get(Group, name):
return f'<a href="/!{name}">!{name}</a>'
else:

View File

@ -32,7 +32,7 @@ def create_group(v):
if not valid_sub_regex.fullmatch(name):
return redirect(f"/ping_groups?error=Name does not match the required format!")
if name in {'everyone', 'jannies'} or g.db.get(Group, name):
if name in {'everyone', 'jannies', 'followers'} or g.db.get(Group, name):
return redirect(f"/ping_groups?error=This group already exists!")
if not v.charge_account('combined', GROUP_COST)[0]: