Merge pull request #61 from BigBotNetwork/greg-dev

Better Code
This commit is contained in:
Skidder 2019-11-16 17:54:14 +01:00 committed by GitHub
commit bde2c05a58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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();