Skip to content

Commit 44285b4

Browse files
committed
Fix for git repos with shortend commit ids that are have other lenghs than 7 characters
1 parent 4ec3894 commit 44285b4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

configTemplate.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ DISCORD_BOT:
22
#the discord bot token needed to log in
33
TOKEN: ""
44
#the prefix the bot will answer to
5-
PREFIX: ";"
5+
PREFIX: "."
66
#the channel ID where to echo the server console
7-
CONSOLE_CHANNEL: ''
7+
CONSOLE_CHANNEL: '796517469224960072'
88
#the channel ID where to write and listen to chat messages
9-
CHAT_CHANNEL: ''
10-
#webhook in chat bridge channel. It sends messages with the minecraft account's username.
11-
chatBridgeWebHookURL: ""
9+
CHAT_CHANNEL: '796519072799653899'
10+
#webhook url in chat bridge channel. It sends messages with the minecraft account's username.
11+
chatBridgeWebHookURL: "https://discord.com/api/webhooks/<webhook id here>/<webhook token here>"
1212

1313

1414
MC_SERVER:
@@ -19,6 +19,7 @@ MC_SERVER:
1919
- "-Xmx2G"
2020
- "-Xms2G"
2121
- "server.jar"
22+
- "-nogui"
2223

2324
#The ip that the status command pings
2425
realIP: "localhost"
@@ -27,7 +28,7 @@ MC_SERVER:
2728
showIP: "localhost"
2829
#The port that players connect to
2930
pingPort: "25565"
30-
# `query.port` in server.properties
31+
#The port that `query.port` in server.properties
3132
queryPort: "25566"
3233

3334
#Due to oddities with YAML any `: ` or `- ` must have the space escaped. (`:\ ` or `-\ `)
@@ -48,16 +49,16 @@ MC_SERVER:
4849
contentGroup: 2
4950

5051
#This is the regex for the printed line indicating when the server has been started.
51-
startRegex: '^\[\d\d:\d\d:\d\d] \[Server thread\/INFO\]:\ Done \(\d+.\d+s\)! For help, type "help"'
52+
startRegex: '^\[\d\d:\d\d:\d\d] \[Server thread\/INFO\]: Done \(\d+.\d+s\)! For help, type "help"'
5253

5354

5455
BACKUP:
5556
#time in seconds between backups ( 0 means disabled)
56-
backup_time: 0
57+
backup_time: 1800
5758
#time after warning before backup
5859
backup_alert: 30
5960
#Where to run server and make backups. Needs to be an initialized git repo. A git repo can be initialized by running `git init`.
60-
gitDirectory: "."
61+
gitDirectory: "/server"
6162

6263
#regex for detecting when the server has let go of the world files.
6364
gitsavereturnRegex: '^\[\d\d:\d\d:\d\d\] \[Server thread\/INFO\]:\ Saved the game'
@@ -67,7 +68,7 @@ BACKUP:
6768
PERMISSIONS:
6869
Global:
6970
Roles:
70-
- ""
71+
- "856719355785904158"
7172
Users:
7273
- ""
7374
server:
@@ -89,4 +90,4 @@ PERMISSIONS:
8990
Roles:
9091
- ""
9192
Users:
92-
- ""
93+
- ""

src/main/java/net/polarbub/botv2/server/git.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ public static boolean rollBack(String ID) {
8181

8282
public static List<String> gitCommit(String comment) {
8383
String branch = runProgString(new ProcessBuilder("git", "branch", "--show-current"));
84-
Pattern commitPattern = Pattern.compile("^\\[" + branch + " ([a-z0-9]{7})\\] " + comment);
84+
Pattern commitPattern = Pattern.compile("^\\[" + branch + " ([a-z0-9]{4,40})\\] " + comment);
8585

8686
runProg.runProg(new ProcessBuilder("git", "add", "-A"));
8787

88-
8988
Process p = runProg.runProgProcess(new ProcessBuilder("git", "commit", "-a", "-m", "\"" + comment + "\""));
9089
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
9190

0 commit comments

Comments
 (0)