Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix_chat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Show more breadcrumbs
Peter Nerlich
matrix_chat
Commits
5c04e733
Commit
5c04e733
authored
8 years ago
by
joenas
Browse files
Options
Downloads
Patches
Plain Diff
Only join configured room
parent
4a64f21a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
config.lua
+1
-1
1 addition, 1 deletion
config.lua
init.lua
+8
-8
8 additions, 8 deletions
init.lua
settingtypes.txt
+1
-1
1 addition, 1 deletion
settingtypes.txt
with
10 additions
and
10 deletions
config.lua
+
1
−
1
View file @
5c04e733
...
...
@@ -29,5 +29,5 @@ end
setting
(
"string"
,
"user"
,
nil
,
true
)
-- User name, fe @digbot:matrix.org
setting
(
"string"
,
"server"
,
nil
,
true
)
-- Server address to connect to
setting
(
"number"
,
"port"
,
8448
)
-- Server port to connect to
setting
(
"string"
,
"
channel
"
,
nil
,
true
)
-- Channel to join (not needed?)
setting
(
"string"
,
"
room_id
"
,
nil
,
true
)
-- Channel to join (not needed?)
setting
(
"string"
,
"password"
,
nil
,
true
)
-- Server password
This diff is collapsed.
Click to expand it.
init.lua
+
8
−
8
View file @
5c04e733
...
...
@@ -32,14 +32,14 @@ end
local
client
=
require
(
"matrix"
).
client
(
"https://"
..
matrix
.
config
.
server
..
":"
..
matrix
.
config
.
port
)
client
:
login_with_password
(
matrix
.
config
.
user
,
matrix
.
config
.
password
,
true
)
local
running
,
start_ts
=
true
,
os.time
()
*
1000
local
start_ts
=
os.time
()
*
1000
client
:
hook
(
"invite"
,
function
(
client
,
room
)
-- When invited to a room, join it
eprintf
(
"Invited to room %s\n"
,
room
)
if
room
.
room_id
==
matrix
.
config
.
room_id
then
client
:
join_room
(
room
)
end
end
):
hook
(
"logged-in"
,
function
(
client
)
matrix
.
connected
=
true
eprintf
(
"Logged in successfully\n"
)
...
...
@@ -59,7 +59,7 @@ end):hook("joined", function (client, room)
eprintf
(
" - %s\n"
,
room
)
end
room
:
send_text
(
"Type “!bot quit” to make the bot exit"
)
--
room:send_text("Type “!bot quit” to make the bot exit")
room
:
hook
(
"message"
,
function
(
room
,
sender
,
message
,
event
)
if
event
.
origin_server_ts
<
start_ts
then
...
...
@@ -83,7 +83,7 @@ end):hook("joined", function (client, room)
end
client
:
logout
()
matrix
.
connected
=
false
else
else
if
room
.
room_id
==
matrix
.
config
.
room_id
then
minetest
.
chat_send_all
(
"<"
..
sender
..
"> "
..
message
.
body
)
end
end
)
...
...
This diff is collapsed.
Click to expand it.
settingtypes.txt
+
1
−
1
View file @
5c04e733
...
...
@@ -13,7 +13,7 @@ matrix.server (Matrix server) string https://matrix.org
matrix.port (Server port) int 8448
# Channel the bot joins after connecting.
matrix.
channel
(Channel to join) string
#minetest
matrix.
room_id
(Channel to join) string
# Matrix user password.
matrix.password (Server password) string
...
...
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