-
Notifications
You must be signed in to change notification settings - Fork 3
/
orientation.py
27 lines (23 loc) · 1000 Bytes
/
orientation.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
from src import ModuleManager, utils
@utils.export("set", utils.Setting("orientation", "owo", example="pansexual"))
class Module(ModuleManager.BaseModule):
_name = "Orientation"
@utils.hook("received.command.orientation")
def orientation(self, event):
"""
:require_setting: orientation
:require_setting_unless: 1
"""
target_user = event["user"]
if event["args"]:
target_name = event["args_split"][0]
if event["server"].has_user_id(target_name):
target_user = event["server"].get_user(target_name)
else:
raise utils.EventError("I don't know who %s is" % target_name)
orientation = target_user.get_setting("orientation", None)
if orientation is None:
event["stderr"].write("%s has no orientation set" %
target_user.nickname)
return
event["stdout"].write(f"{target_user.nickname} is {orientation.strip()}")