mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +01:00
classes: revise some function descriptions
This commit is contained in:
parent
011d70e816
commit
242267a4a2
26
classes.py
26
classes.py
@ -676,11 +676,13 @@ class PyLinkNetworkCore(structures.CamelCaseToSnakeCase):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def is_internal_client(self, numeric):
|
def is_internal_client(self, uid):
|
||||||
"""
|
"""
|
||||||
Returns whether the given client numeric (UID) is a PyLink client.
|
Returns whether the given UID is a PyLink client.
|
||||||
|
|
||||||
|
This returns False if the numeric doesn't exist.
|
||||||
"""
|
"""
|
||||||
sid = self.get_server(numeric)
|
sid = self.get_server(uid)
|
||||||
if sid and self.servers[sid].internal:
|
if sid and self.servers[sid].internal:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -689,25 +691,25 @@ class PyLinkNetworkCore(structures.CamelCaseToSnakeCase):
|
|||||||
"""Returns whether the given SID is an internal PyLink server."""
|
"""Returns whether the given SID is an internal PyLink server."""
|
||||||
return (sid in self.servers and self.servers[sid].internal)
|
return (sid in self.servers and self.servers[sid].internal)
|
||||||
|
|
||||||
def get_server(self, numeric):
|
def get_server(self, uid):
|
||||||
"""Finds the SID of the server a user is on."""
|
"""Finds the ID of the server a user is on. Return None if the user does not exist."""
|
||||||
userobj = self.users.get(numeric)
|
userobj = self.users.get(uid)
|
||||||
if userobj:
|
if userobj:
|
||||||
return userobj.server
|
return userobj.server
|
||||||
|
|
||||||
def is_manipulatable_client(self, uid):
|
def is_manipulatable_client(self, uid):
|
||||||
"""
|
"""
|
||||||
Returns whether the given user is marked as an internal, manipulatable
|
Returns whether the given client is marked manipulatable for interactions
|
||||||
client. Usually, automatically spawned services clients should have this
|
such as force-JOIN.
|
||||||
set True to prevent interactions with opers (like mode changes) from
|
|
||||||
causing desyncs.
|
|
||||||
"""
|
"""
|
||||||
return self.is_internal_client(uid) and self.users[uid].manipulatable
|
return self.is_internal_client(uid) and self.users[uid].manipulatable
|
||||||
|
|
||||||
def get_service_bot(self, uid):
|
def get_service_bot(self, uid):
|
||||||
"""
|
"""
|
||||||
Checks whether the given UID is a registered service bot. If True,
|
Checks whether the given UID exists and is a registered service bot.
|
||||||
returns the cooresponding ServiceBot object.
|
|
||||||
|
If True, returns the corresponding ServiceBot object.
|
||||||
|
Otherwise, return False.
|
||||||
"""
|
"""
|
||||||
userobj = self.users.get(uid)
|
userobj = self.users.get(uid)
|
||||||
if not userobj:
|
if not userobj:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user