Skip to content
This repository was archived by the owner on Jul 29, 2021. It is now read-only.

Commit 2203bb7

Browse files
Pre-Release v0.2.0a Build 0 (#12)
* Finalization updates for pre-release - Prefix configuration added - Warnings finalized * Finalized Pre-Release v0.2.0a Build 0 * Removed extra remnants of the welcome command
1 parent 05e58d4 commit 2203bb7

File tree

4 files changed

+71
-12
lines changed

4 files changed

+71
-12
lines changed

Project-Lynx/src/main/java/commands/moderation/Warnings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public boolean action(MessageChannel chn, String msg, Object misc) {
3434
if(generatedWarnings.equals("")) {
3535
MessageHandler.sendMessage(chn, punished.getName() + " has no logged warnings.");
3636
} else {
37-
MessageHandler.sendMessage(chn, "> **" + punished.getName() + "'s List of Warnings**\n\n" + generatedWarnings);
37+
MessageHandler.sendMessage(chn, "> **List of Warnings for:** `" + punished.getAsTag() + "`\n\n" + generatedWarnings);
3838
}
3939

4040
}
@@ -61,7 +61,7 @@ public String generateWarningsList(Guild gld, User usr) {
6161
if(arr.getString(1).equals(usr.getId())) {
6262
construct +=
6363
"**Warning ID**: " + key +
64-
"\n**Moderator**: " + gld.getMemberById(arr.getLong(0)) +
64+
"\n**Moderator**: " + gld.getMemberById(arr.getLong(0)).getUser().getAsTag() + " (" + gld.getMemberById(arr.getLong(0)).getUser().getId() + ")" +
6565
"\n**Reason**: " + arr.getString(2) + "\n\n";
6666
}
6767

Project-Lynx/src/main/java/commands/utilities/Configure.java

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,35 @@
1515
import net.dv8tion.jda.api.entities.User;
1616
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
1717

18+
enum SpecialConfigs {
19+
20+
PREFIX("prefix", 0),
21+
URP("urp", 1);
22+
23+
private String assignmentName = "DEFAULT";
24+
private int assignmentNum = -1;
25+
26+
SpecialConfigs(String n, int i) {
27+
setAssignmentName(n);
28+
setAssignmentNum(i);
29+
}
30+
31+
public String getAssignmentName() {
32+
return assignmentName;
33+
}
34+
public int getAssignmentNum() {
35+
return assignmentNum;
36+
}
37+
38+
public void setAssignmentName(String assignmentName) {
39+
this.assignmentName = assignmentName;
40+
}
41+
public void setAssignmentNum(int assignmentNum) {
42+
this.assignmentNum = assignmentNum;
43+
}
44+
45+
}
46+
1847
enum Commands {
1948

2049
// This will suffice for now lol
@@ -236,6 +265,42 @@ public boolean action(MessageChannel chn, String msg, Object misc) {
236265
}
237266

238267
}
268+
269+
// Iterate through the special configs
270+
for(SpecialConfigs sc: SpecialConfigs.values()) {
271+
if(sc.getAssignmentName().equals("prefix")) {
272+
273+
JSONObject rawData = Data.rawJSON;
274+
String replaceText = msg;
275+
String parsedPrefix = null;
276+
277+
// Parse the prefix
278+
try {
279+
replaceText = replaceText.replace("configure prefix", "");
280+
replaceText = replaceText.replace(" ", "");
281+
parsedPrefix = replaceText;
282+
} catch(Exception e) {
283+
e.printStackTrace();
284+
}
285+
286+
// Verify it isn't null
287+
if(parsedPrefix == null) {
288+
MessageHandler.sendMessage(chn, "Prefix was unable to be parsed!");
289+
return false;
290+
}
291+
292+
if(parsedPrefix.equals("")) {
293+
MessageHandler.sendMessage(chn, "Prefix cannot be null!");
294+
return false;
295+
}
296+
297+
rawData.getJSONObject(gld.getId()).getJSONObject("srvr_config").put("prefix", parsedPrefix);
298+
299+
// Write the new data
300+
if(Data.writeData(InitData.locationJSON, rawData.toString(), true, gld.getId()))
301+
MessageHandler.sendMessage(chn, "You've configured the bot to use the new prefix of " + parsedPrefix);
302+
}
303+
}
239304

240305
return true;
241306
} else {

Project-Lynx/src/main/java/init/InitData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ public class InitData {
7878
/*
7979
* Use this to define the version
8080
*/
81-
public static String version = "0.2.0a (unfinished) - The Rewrite Update";
81+
public static String version = "Pre-Release v0.2.0a Build 0 - The Rewrite Update";
8282

8383
}

resources/guildData.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"DEFAULT": {
1+
{
2+
"DEFAULT": {
23
"cmds_config": {
34
"warn": {
45
"roleIDs": [],
@@ -28,13 +29,6 @@
2829
"active": true,
2930
"logging": false
3031
},
31-
"welcome": {
32-
"roleIDs": [],
33-
"tier_level": 0,
34-
"userIDs": [],
35-
"active": false,
36-
"logging": false
37-
},
3832
"ban": {
3933
"roleIDs": [],
4034
"tier_level": 0,
@@ -45,7 +39,6 @@
4539
},
4640
"srvr_config": {
4741
"prefix": "!",
48-
"welcome": false,
4942
"user_raid_prot": {
5043
"active": true,
5144
"user_moving_avg": 0,
@@ -59,3 +52,4 @@
5952
"logging_channel": null
6053
}
6154
}
55+
}

0 commit comments

Comments
 (0)