Bass Command #329

Merged
greg6775 merged 23 commits from greg-dev into master 2020-01-17 17:59:53 +01:00
3 changed files with 1 additions and 76 deletions
Showing only changes of commit 82135650fe - Show all commits

View file

@ -103,8 +103,7 @@ public class Hadder {
new StopCommand(),
new BlacklistCommand(),
new PauseCommand(),
new LoopCommand(),
new WakaTimeCommand()), config, helpCommand);
new LoopCommand()), config, helpCommand);
builder.addEventListeners(
new MentionListener(rethink),

View file

@ -1,69 +0,0 @@
package com.bbn.hadder.commands.misc;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
/**
* @author Skidder / GregTCLTK
*/
public class WakaTimeCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (args.length == 1) {
Request request = new Request.Builder().url("https://wakatime.com/api/v1/users/" + args[0]).addHeader("Authorization", "Basic " + event.getConfig().getWakaTimeToken()).build();
try {
Response response = new OkHttpClient().newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"",
"").build()).queue();
} catch (JSONException e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.misc.wakatime.user.error.title",
"commands.misc.wakatime.user.error.description").build()).queue();
} catch (IOException | NullPointerException e) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.misc.wakatime.api.error.title",
"commands.misc.wakatime.api.error.description")
.build()
).queue();
}
} else {
event.getHelpCommand().sendHelp(this, event);
}
}
@Override
public String[] labels() {
return new String[]{"wakatime", "wk"};
}
@Override
public String description() {
return "commands.misc.wakatime.help.description";
}
@Override
public String usage() {
return "[WakaTime-User]";
}
@Override
public String example() {
return "@Skidder";
}
}

View file

@ -73,11 +73,6 @@ commands.misc.screenshare.number.error.description = This isn't a Number.
commands.misc.screenshare.channel.existing.error = Hol' up
commands.misc.screenshare.channel.existing.description = There is no Voice Channel named like this. \n\nNote\: Make sure the Voice Channel is in this Guild.
commands.misc.screenshare.help.description = Shows you the link to share your screen.
commands.misc.wakatime.api.error.title = API error
commands.misc.wakatime.api.error.description = The WakaTime API might be down at the moment\!
commands.misc.wakatime.user.error.title = User doesn't exist
commands.misc.wakatime.user.error.description = I can not find a user named like this\!
commands.misc.wakatime.help.description = Show the WakaTime stats of the specified user.
commands.moderation.ban.success.title = Successfully banned
commands.moderation.ban.success.description = I successfully baned %extra%