mirror of
https://github.com/nikdoof/mumblepy.git
synced 2025-12-17 19:59:26 +00:00
Add another example
This commit is contained in:
@@ -23,8 +23,11 @@ You'll need to select a server instance using the Meta interface. You can either
|
|||||||
servers = meta.get_all_servers()
|
servers = meta.get_all_servers()
|
||||||
server = meta.get_server(1)
|
server = meta.get_server(1)
|
||||||
|
|
||||||
Full Example
|
Examples
|
||||||
============
|
========
|
||||||
|
|
||||||
|
List Online Users
|
||||||
|
-----------------
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -37,3 +40,22 @@ Full Example
|
|||||||
print "====="
|
print "====="
|
||||||
for user in server.get_users():
|
for user in server.get_users():
|
||||||
print "* %s" % user.name
|
print "* %s" % user.name
|
||||||
|
|
||||||
|
|
||||||
|
Kick Idle Users
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from mumble import Meta
|
||||||
|
|
||||||
|
TIMEOUT = 3600
|
||||||
|
ICE_WRITE_SECRET = 'secret'
|
||||||
|
SERVER_ID = 1
|
||||||
|
|
||||||
|
meta = Meta(ICE_WRITE_SECRET)
|
||||||
|
server = meta.get_server(SERVER_ID)
|
||||||
|
for user in server.get_users():
|
||||||
|
if user.idle_seconds >= TIMEOUT:
|
||||||
|
user.kick()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user