mirror of
https://github.com/ahabhyde/miguelbridge
synced 2025-01-26 14:04:20 +01:00
HomeServer in settings
This commit is contained in:
parent
c51262aa65
commit
f5e4f582f8
@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"tguser": "Telegram user name",
|
|
||||||
"matrixuser": "Matrix user name",
|
"matrixuser": "Matrix user name",
|
||||||
"tgtoken": "Token key given from BotFather",
|
"tgtoken": "Token key given from BotFather",
|
||||||
"matrixpswd": "Matrix user password",
|
"matrixpswd": "Matrix user password",
|
||||||
"matrixhomeserver": "Matrix home server url",
|
"matrixhomeserver": "https://homeserver.com/_matrix/client/r0",
|
||||||
|
|
||||||
"rooms": [{
|
"rooms": [{
|
||||||
"tgname": "Name of the room in Telegram",
|
"tgname": "Name of the room in Telegram",
|
||||||
|
@ -27,8 +27,8 @@ public class MatrixBot {
|
|||||||
this.accessToken = accessToken;
|
this.accessToken = accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MatrixBot() {
|
public MatrixBot() throws IOException, FileNotFoundException, ParseException {
|
||||||
homeUrl = "https://maxwell.ydns.eu/_matrix/client/r0";
|
homeUrl = getHomeServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String readBotUserName() throws FileNotFoundException, IOException, ParseException {
|
public static String readBotUserName() throws FileNotFoundException, IOException, ParseException {
|
||||||
@ -55,6 +55,18 @@ public class MatrixBot {
|
|||||||
return pswd;
|
return pswd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getHomeServer() throws FileNotFoundException, IOException, ParseException {
|
||||||
|
FileReader file = new FileReader(Launcher.fileSettings);
|
||||||
|
BufferedReader in = new BufferedReader(file);
|
||||||
|
|
||||||
|
JSONObject obj = (JSONObject) new JSONParser().parse(in);
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
String server = (String) obj.get("matrixhomeserver");
|
||||||
|
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Access Token per il bot, da utilizzare nelle prossime richieste HTTP
|
* @return Access Token per il bot, da utilizzare nelle prossime richieste HTTP
|
||||||
|
Loading…
Reference in New Issue
Block a user