Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tool_matrixbot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
FOSS-AG
tool_matrixbot
Commits
6d41b60f
Commit
6d41b60f
authored
Feb 18, 2019
by
Michael G
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:foss-ag/tool_matrixbot
parents
24de9273
db3f4aa6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
klo/klo.py
+12
-2
12 additions, 2 deletions
klo/klo.py
with
12 additions
and
2 deletions
klo/klo.py
+
12
−
2
View file @
6d41b60f
...
@@ -2,8 +2,15 @@
...
@@ -2,8 +2,15 @@
from
matrix_client.client
import
MatrixClient
from
matrix_client.client
import
MatrixClient
client
=
MatrixClient
(
"
https://matrix.org
"
)
# Called when a message is recieved.
def
on_message
(
room
,
event
):
if
event
[
'
type
'
]
==
"
m.room.message
"
:
if
event
[
'
content
'
][
'
msgtype
'
]
==
"
m.text
"
:
print
(
"
{0}: {1}
"
.
format
(
event
[
'
sender
'
],
event
[
'
content
'
][
'
body
'
]))
client
=
MatrixClient
(
"
https://matrix.org
"
)
# New user
# New user
#token = client.register_with_password(username="foobar", password="monkey")
#token = client.register_with_password(username="foobar", password="monkey")
...
@@ -13,3 +20,6 @@ token = client.login(username="foss-ag_klo", password="justklo")
...
@@ -13,3 +20,6 @@ token = client.login(username="foss-ag_klo", password="justklo")
#room = client.create_room("#klotest:matrix.org")
#room = client.create_room("#klotest:matrix.org")
room
=
client
.
join_room
(
"
#klotest:matrix.org
"
)
room
=
client
.
join_room
(
"
#klotest:matrix.org
"
)
room
.
send_text
(
"
Hello!
"
)
room
.
send_text
(
"
Hello!
"
)
room
.
add_listener
(
on_message
)
client
.
start_listener_thread
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment