More error messages
This commit is contained in:
parent
4725f4a123
commit
c13e5249d1
2 changed files with 35 additions and 0 deletions
|
|
@ -2,6 +2,14 @@ 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
|
||||
|
|
@ -11,7 +19,30 @@ 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]).build();
|
||||
|
||||
try {
|
||||
Response response = new OkHttpClient().newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
event.getTextChannel().sendMessage("jisdfids").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
|
||||
|
|
|
|||
|
|
@ -73,6 +73,10 @@ 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.moderation.ban.success.title = Successfully banned
|
||||
commands.moderation.ban.success.description = I successfully baned %extra%
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue