11package com .javadiscord .javabot ;
22
3+ import com .jagrosh .jdautilities .command .CommandClientBuilder ;
4+ import com .jagrosh .jdautilities .commons .waiter .EventWaiter ;
35import com .javadiscord .javabot .commands .configuation .Config ;
46import com .javadiscord .javabot .commands .configuation .WelcomeImage ;
57import com .javadiscord .javabot .commands .custom_commands .CustomCommands ;
68import com .javadiscord .javabot .commands .moderation .*;
79import com .javadiscord .javabot .commands .other .GuildConfig ;
10+ import com .javadiscord .javabot .commands .other .Question ;
11+ import com .javadiscord .javabot .commands .other .Shutdown ;
12+ import com .javadiscord .javabot .commands .other .Version ;
813import com .javadiscord .javabot .commands .other .qotw .ClearQOTW ;
914import com .javadiscord .javabot .commands .other .qotw .Correct ;
1015import com .javadiscord .javabot .commands .other .qotw .Leaderboard ;
11- import com .javadiscord .javabot .commands .other .Question ;
12- import com .javadiscord .javabot .commands .other .Shutdown ;
1316import com .javadiscord .javabot .commands .other .suggestions .Accept ;
1417import com .javadiscord .javabot .commands .other .suggestions .Clear ;
1518import com .javadiscord .javabot .commands .other .suggestions .Decline ;
1619import com .javadiscord .javabot .commands .other .suggestions .Response ;
1720import com .javadiscord .javabot .commands .other .testing .*;
18- import com .javadiscord .javabot .commands .other .Version ;
1921import com .javadiscord .javabot .commands .reaction_roles .ReactionRoles ;
2022import com .javadiscord .javabot .commands .user_commands .*;
2123import com .javadiscord .javabot .events .*;
22- import com .javadiscord .javabot .properties .ConfigString ;
23- import com .jagrosh .jdautilities .command .CommandClientBuilder ;
24- import com .jagrosh .jdautilities .commons .waiter .EventWaiter ;
24+ import com .javadiscord .javabot .properties .MultiProperties ;
2525import net .dv8tion .jda .api .JDA ;
2626import net .dv8tion .jda .api .JDABuilder ;
2727import net .dv8tion .jda .api .OnlineStatus ;
2828import net .dv8tion .jda .api .requests .GatewayIntent ;
2929import net .dv8tion .jda .api .utils .MemberCachePolicy ;
3030import net .dv8tion .jda .api .utils .cache .CacheFlag ;
3131
32+ import java .nio .file .Path ;
33+ import java .util .Properties ;
34+
3235
3336public class Bot {
3437
3538 public static JDA jda ;
3639 public static EventWaiter waiter ;
3740
41+ private static final Properties properties = new MultiProperties (Path .of ("bot.props" ));
3842
3943 public static void main (String [] args ) throws Exception {
40-
41- ConfigString token = new ConfigString ("token" , "null" );
4244 waiter = new EventWaiter ();
4345
4446 CommandClientBuilder client = new CommandClientBuilder ()
@@ -113,7 +115,7 @@ public static void main(String[] args) throws Exception {
113115 );
114116
115117
116- jda = JDABuilder .createDefault (token . getValue ( ))
118+ jda = JDABuilder .createDefault (properties . getProperty ( "token" , "null" ))
117119 .setStatus (OnlineStatus .DO_NOT_DISTURB )
118120 .setMemberCachePolicy (MemberCachePolicy .ALL )
119121 .enableCache (CacheFlag .ACTIVITY )
@@ -136,5 +138,26 @@ public static void main(String[] args) throws Exception {
136138 jda .addEventListener (new SlashCommands ());
137139 //jda.addEventListener(new StarboardListener());
138140 }
141+
142+ /**
143+ * Gets the value of a property from the bot's loaded properties.
144+ * @see Properties#getProperty(String)
145+ * @param key The name of the property to get.
146+ * @return The value of the property, or <code>null</code> if none was found.
147+ */
148+ public static String getProperty (String key ) {
149+ return properties .getProperty (key );
150+ }
151+
152+ /**
153+ * Gets the value of a property from the bot's loaded properties.
154+ * @see Properties#getProperty(String, String)
155+ * @param key The name of the property to get.
156+ * @param defaultValue The value to return if no property was found.
157+ * @return The value of the property, or the default value.
158+ */
159+ public static String getProperty (String key , String defaultValue ) {
160+ return properties .getProperty (key , defaultValue );
161+ }
139162}
140163
0 commit comments