Files
lua-matrix/examples/client-send-message.lua
Adrian Perez de Castro 30eec81619 Update client-send-message.lua to not do an initial sync
The initial sync is not needed, provided that the user has to supply anyway
the room ID or alias in the command line of the script.
2016-07-04 18:34:23 +03:00

23 lines
554 B
Lua

#! /usr/bin/env lua
--
-- send-message.lua
-- Copyright (C) 2016 Adrian Perez <aperez@igalia.com>
--
-- Distributed under terms of the MIT license.
--
if #arg ~= 4 then
io.stderr:write(string.format("Usage: %s <homeserver-URL> <username> <password> <room>\n", arg[0]))
os.exit(1)
end
local client = require "matrix" .client(arg[1])
-- Passing "true" as last parameter skips the initial sync, which can be slow
client:login_with_password(arg[2], arg[3], true)
local room = client:join_room(arg[4])
room:send_text(io.read("*a"))
client:logout()