Better Code

This commit is contained in:
GregTCLTK 2019-11-16 17:00:35 +01:00
parent 983ea31deb
commit 0b644af5ac
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
2 changed files with 2 additions and 8 deletions

View file

@ -47,7 +47,7 @@ public class Hadder {
new ShutdownCommand(), new ShutdownCommand(),
new KickCommand(), new KickCommand(),
new PingCommand(), new PingCommand(),
new GifCommand(config), new GifCommand(),
new ClearCommand(), new ClearCommand(),
new GitHubCommand(), new GitHubCommand(),
new ScreenshareCommand(), new ScreenshareCommand(),

View file

@ -19,12 +19,6 @@ import java.util.Random;
public class GifCommand implements Command { public class GifCommand implements Command {
private Config config;
public GifCommand(Config config) {
this.config = config;
}
@Override @Override
public void executed(String[] args, CommandEvent event) { public void executed(String[] args, CommandEvent event) {
if (args.length > 0) { if (args.length > 0) {
@ -35,7 +29,7 @@ public class GifCommand implements Command {
} }
OkHttpClient caller = new OkHttpClient(); OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + config.getGiphyToken()).build(); Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + event.getConfig().getGiphyToken()).build();
try { try {
Random rand = new Random(); Random rand = new Random();
Response response = caller.newCall(request).execute(); Response response = caller.newCall(request).execute();