Added the option to !opt-in/opt-out [onlinebot only]
Fixed command & event threading Events are now threaded by event_type (i.e. all buddy_logon events get ran in the same one) Added default preferences Fixed recipe loading for multiple installs (i.e. on different machines)
This commit is contained in:
@@ -52,7 +52,7 @@ class MailController:
|
||||
def logon_event(self, _, data):
|
||||
if not self.bot.is_ready():
|
||||
return
|
||||
if data.account.disabled == 1:
|
||||
if not self.account_service.simple_checks(data.account):
|
||||
return
|
||||
if "mail" in self.buddy_service.get_buddy(data.packet.char_id)["types"]:
|
||||
self.job_schedule.delayed_job(self.send_mail, 16, data.packet.char_id, self.get_mails(data.packet.char_id))
|
||||
@@ -129,8 +129,10 @@ class MailController:
|
||||
recipient = self.account_service.get_account(receiver.char_id)
|
||||
if not recipient:
|
||||
return f"No account for <highlight>{receiver.name}</highlight> found."
|
||||
if recipient.member == -1 or recipient.disabled == 1:
|
||||
return f"The Character <highlight>{recipient.name}</highlight> has " \
|
||||
|
||||
# if recipient.member == -1 or recipient.disabled == 1:
|
||||
if not self.account_service.simple_checks(recipient):
|
||||
return f"The Character <highlight>{recipient.name}</highlight> has " \
|
||||
f"no active account in <highlight><myname></highlight>."
|
||||
self.db.exec("INSERT INTO mail(sender, recipient, text, sent_at) VALUES(?, ?, ?, ?)",
|
||||
[sender.sender.char_id, recipient.main, message, time.time()])
|
||||
@@ -152,12 +154,12 @@ class MailController:
|
||||
group = self.account_service.get_group_tag(recipient)
|
||||
users = []
|
||||
if group:
|
||||
if group == "all":
|
||||
if sender.sender.access_level['level'] > 20:
|
||||
return "This group is unavailable."
|
||||
users = self.account_service.get_all_members()
|
||||
else:
|
||||
users = self.account_service.get_by_group(group)
|
||||
# if group == "all":
|
||||
# if sender.sender.access_level['level'] > 20:
|
||||
# return "This group is unavailable."
|
||||
# users = self.account_service.get_all_members()
|
||||
# else:
|
||||
users = self.account_service.get_by_group(group)
|
||||
|
||||
elif not group:
|
||||
return f"Sorry, but the group <highlight>{recipient}</highlight> does not exist. " \
|
||||
|
||||
Reference in New Issue
Block a user