mirror of
https://github.com/ahabhyde/miguelbridge
synced 2025-01-25 05:24:19 +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",
|
||||
"tgtoken": "Token key given from BotFather",
|
||||
"matrixpswd": "Matrix user password",
|
||||
"matrixhomeserver": "Matrix home server url",
|
||||
"matrixhomeserver": "https://homeserver.com/_matrix/client/r0",
|
||||
|
||||
"rooms": [{
|
||||
"tgname": "Name of the room in Telegram",
|
||||
|
@ -27,8 +27,8 @@ public class MatrixBot {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public MatrixBot() {
|
||||
homeUrl = "https://maxwell.ydns.eu/_matrix/client/r0";
|
||||
public MatrixBot() throws IOException, FileNotFoundException, ParseException {
|
||||
homeUrl = getHomeServer();
|
||||
}
|
||||
|
||||
public static String readBotUserName() throws FileNotFoundException, IOException, ParseException {
|
||||
@ -55,6 +55,18 @@ public class MatrixBot {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user