Merge branch 'greg-dev' into hax-dev

This commit is contained in:
Skidder 2020-01-21 08:18:34 +01:00 committed by GitHub
commit 03042cc239
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 2078 additions and 1244 deletions

View file

@ -69,7 +69,7 @@ further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team on [Discord](https://discordapp.com/invite/Vf4zCYn). All
reported by contacting the project team on [Discord](https://discordapp.com/invite/58My2dM). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder;
import com.bbn.hadder.audio.AudioManager;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder;
import com.bbn.hadder.core.Config;
@ -10,9 +26,6 @@ import org.json.JSONObject;
import java.lang.reflect.Field;
import java.util.NoSuchElementException;
/*
* @author Skidder / GregTCLTK
*/
public class Rethink {
private RethinkDB r = RethinkDB.r;

View file

@ -1,12 +1,24 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.audio;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import net.dv8tion.jda.api.entities.Member;
/**
* @author Skidder / GregTCLTK
*/
public class AudioInfo {
private final AudioTrack track;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.audio;
import com.bbn.hadder.commands.CommandEvent;
@ -19,10 +35,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author Skidder / GregTCLTK
*/
public class AudioManager {
public Map<String, Map.Entry<AudioPlayer, TrackManager>> players = new HashMap<>();

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.audio;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
@ -7,10 +23,6 @@ import net.dv8tion.jda.api.audio.AudioSendHandler;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
/**
* @author Skidder / GregTCLTK
*/
public class AudioPlayerSendHandler implements AudioSendHandler {
private final AudioPlayer audioPlayer;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.audio;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
@ -11,15 +27,12 @@ import net.dv8tion.jda.api.entities.VoiceChannel;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
/**
* @author Skidder / GregTCLTK
*/
public class TrackManager extends AudioEventAdapter {
private final AudioPlayer player;
private final AudioManager manager;
private final Queue<AudioInfo> queue;
AudioTrack lastTrack;
private boolean loop = false;
public TrackManager(AudioPlayer player, AudioManager manager) {
@ -51,8 +64,9 @@ public class TrackManager extends AudioEventAdapter {
@Override
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
Guild g = queue.poll().getAuthor().getGuild();
this.lastTrack = track;
if (loop) {
player.playTrack(track.makeClone());
player.playTrack(lastTrack.makeClone());
} else if (queue.isEmpty()) {
manager.players.remove(g.getId());
manager.getPlayer(g).destroy();

View file

@ -1,11 +1,23 @@
package com.bbn.hadder.commands;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands;
public interface Command {
void executed(String[] args, CommandEvent event);
void executed(String[] args, CommandEvent e);
String[] labels();

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands;
import com.bbn.hadder.Rethink;

View file

@ -1,22 +1,35 @@
package com.bbn.hadder.commands.fun;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.fun;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.User;
public class AvatarCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length == 0) {
Member member = event.getMember();
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
Member member = e.getMember();
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.fun.avatar.success.title",
member.getUser().getAsTag(),
@ -25,10 +38,10 @@ public class AvatarCommand implements Command {
.setImage(member.getUser().getAvatarUrl())
.setFooter(member.getUser().getAsTag())
.build()).queue();
} else if (event.getMessage().getMentionedMembers().size() == 1) {
Member member = event.getMessage().getMentionedMembers().get(0);
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
} else if (e.getMessage().getMentionedMembers().size() == 1) {
Member member = e.getMessage().getMentionedMembers().get(0);
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.fun.avatar.success.title",
member.getUser().getAsTag(),
@ -38,19 +51,28 @@ public class AvatarCommand implements Command {
.setFooter(member.getUser().getAsTag())
.build()).queue();
} else if (args[0].length() == 18) {
Member member = event.getGuild().getMemberById(args[0]);
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
try {
User u = e.getJDA().getUserById(args[0]);
System.out.println(u);
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.fun.avatar.success.title",
member.getUser().getAsTag(),
u.getAsTag(),
"",
"")
.setImage(member.getUser().getAvatarUrl())
.setFooter(member.getUser().getAsTag())
.setImage(u.getAvatarUrl())
.setFooter(u.getAsTag())
.build()).queue();
} catch (NullPointerException ignore) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.fun.avatar.error.title",
"commands.fun.avatar.error.description"
).build()).queue();
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.fun;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.fun;
import club.minnced.discord.webhook.WebhookClient;
import club.minnced.discord.webhook.WebhookClientBuilder;
import com.bbn.hadder.commands.Command;
@ -24,13 +36,13 @@ import java.util.concurrent.TimeUnit;
public class ClydeCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) {
TextChannel channel = event.getMessage().getTextChannel();
String content = event.getMessage().getContentRaw().replace(event.getRethinkServer().getPrefix(), "").replace(event.getRethinkUser().getPrefix(), "").replace("clyde", "");
Webhook webhook = channel.createWebhook(event.getConfig().getClydeName()).complete();
Webhook webhook = channel.createWebhook(e.getConfig().getClydeName()).complete();
try {
InputStream s = new URL("https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png").openStream();
webhook.getManager().setAvatar(Icon.from(s)).queue();
@ -40,24 +52,24 @@ public class ClydeCommand implements Command {
WebhookClient client = builder.build();
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
client.send(content);
} catch (Exception e) {
e.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
webhook.delete().queue();
event.getMessage().delete().queue();
e.getMessage().delete().queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else event.getHelpCommand().sendHelp(this, event);
} else e.getHelpCommand().sendHelp(this, e);
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.fun;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.fun;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -18,7 +30,7 @@ import java.util.Random;
public class GifCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
StringBuilder query = new StringBuilder();
for (String arg : args) {
@ -27,7 +39,7 @@ public class GifCommand implements Command {
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + event.getConfig().getGiphyToken()).build();
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + e.getConfig().getGiphyToken()).build();
try {
Random rand = new Random();
Response response = client.newCall(request).execute();
@ -35,15 +47,15 @@ public class GifCommand implements Command {
JSONArray array = json.getJSONArray("data");
int gifIndex = rand.nextInt(array.length());
String url = array.getJSONObject(gifIndex).get("url").toString();
event.getTextChannel().sendMessage(url).queue();
} catch (Exception e) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(url).queue();
} catch (Exception ignore) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"error",
"commands.fun.gif.error.description").build()).queue();
}
} else event.getHelpCommand().sendHelp(this, event);
} else e.getHelpCommand().sendHelp(this, e);
}
@Override

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.fun;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.fun;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -18,7 +30,7 @@ import java.io.IOException;
public class MemeCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url("https://meme-api.herokuapp.com/gimme").build();
@ -27,16 +39,15 @@ public class MemeCommand implements Command {
Response response = client.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
String url = json.getString("url");
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.fun.meme.success.title", "")
.setImage(url)
.setAuthor("Subreddit: " + json.getString("subreddit"))
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
} catch (IOException ignore) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"error",
"commands.fun.meme.api.error")

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.general;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.general;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -11,13 +23,13 @@ import com.bbn.hadder.utils.MessageEditor;
public class AboutCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.general.about.success.title",
"commands.general.about.success.description")
.addField(event.getMessageEditor().getTerm("commands.general.about.success.field.one.title"), event.getMessageEditor().getTerm("commands.general.about.success.field.one.description", "(https://donatebot.io/checkout/448554629282922527?buyer=" + event.getAuthor().getId() + "). :smiley:", ""), true)
.addField(e.getMessageEditor().getTerm("commands.general.about.success.field.one.title"), e.getMessageEditor().getTerm("commands.general.about.success.field.one.description", "(https://donatebot.io/checkout/448554629282922527?buyer=" + e.getAuthor().getId() + "). :smiley:", ""), true)
.setThumbnail("https://bigbotnetwork.com/images/Hadder.png")
.build()).queue();
}

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.general;
import com.bbn.hadder.commands.Command;
@ -5,37 +21,33 @@ import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.EventWaiter;
import com.bbn.hadder.utils.MessageEditor;
/*
* @author Skidder / GregTCLTK
*/
public class EqualsCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
event.getChannel().sendMessage(
event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
e.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.general.equals.string.first.request", "")
.build()).queue();
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
String firstString = msgevent.getMessage().getContentRaw();
event.getChannel().sendMessage(
event.getMessageEditor().getMessage(
new EventWaiter().newOnMessageEventWaiter(msge -> {
String firstString = msge.getMessage().getContentRaw();
e.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.general.equals.string.second.request",
"").build()).queue();
new EventWaiter().newOnMessageEventWaiter(msgevent2 -> {
String secondString = msgevent2.getMessage().getContentRaw();
event.getChannel().sendMessage(
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setTitle((firstString.equals(secondString)) ? event.getMessageEditor().getTerm( "commands.general.equals.string.equals.true") : event.getMessageEditor().getTerm( "commands.general.equals.string.equals.false"))
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.first"), firstString, false)
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.second"), secondString, false)
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.result"), String.valueOf(firstString.equals(secondString)), false)
new EventWaiter().newOnMessageEventWaiter(msge2 -> {
String secondString = msge2.getMessage().getContentRaw();
e.getChannel().sendMessage(
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setTitle((firstString.equals(secondString)) ? e.getMessageEditor().getTerm( "commands.general.equals.string.equals.true") : e.getMessageEditor().getTerm( "commands.general.equals.string.equals.false"))
.addField(e.getMessageEditor().getTerm( "commands.general.equals.string.first"), firstString, false)
.addField(e.getMessageEditor().getTerm( "commands.general.equals.string.second"), secondString, false)
.addField(e.getMessageEditor().getTerm( "commands.general.equals.string.result"), String.valueOf(firstString.equals(secondString)), false)
.build()).queue();
}, event.getJDA(), event.getAuthor());
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
}, e.getJDA(), e.getAuthor());
}
@Override

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.general;
import com.bbn.hadder.commands.Command;
@ -13,11 +29,11 @@ import java.util.Map;
public class HelpCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
public void executed(String[] args, CommandEvent e) {
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
if (args.length == 0) {
HashMap<String, ArrayList<Command>> hashMap = new HashMap<>();
for (Command cmd : event.getCommandHandler().getCommandList()) {
for (Command cmd : e.getCommandHandler().getCommandList()) {
if (!hashMap.containsKey(cmd.getClass().getPackageName())) {
ArrayList<Command> cmdlist = new ArrayList<>();
cmdlist.add(cmd);
@ -28,8 +44,8 @@ public class HelpCommand implements Command {
}
EmbedBuilder eb = new EmbedBuilder();
for (Map.Entry<String, ArrayList<Command>> entry : hashMap.entrySet()) {
if (!entry.getKey().endsWith("owner") || (entry.getKey().endsWith("owner") && (event.getAuthor().getId().equals("477141528981012511") ||
event.getAuthor().getId().equals("261083609148948488")))) {
if (!entry.getKey().endsWith("owner") || (entry.getKey().endsWith("owner") && (e.getAuthor().getId().equals("477141528981012511") ||
e.getAuthor().getId().equals("261083609148948488")))) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < entry.getValue().size(); i++) {
Command cmd = entry.getValue().get(i);
@ -40,35 +56,35 @@ public class HelpCommand implements Command {
eb.addField(ps[ps.length - 1], sb.toString(), false);
}
}
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO);
event.getChannel().sendMessage(eb.build()).queue();
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO);
e.getChannel().sendMessage(eb.build()).queue();
} else {
for (Command cmd : event.getCommandHandler().getCommandList()) {
for (Command cmd : e.getCommandHandler().getCommandList()) {
for (String label : cmd.labels()) {
if (label.equalsIgnoreCase(args[0])) {
sendHelp(cmd, event);
sendHelp(cmd, e);
}
}
}
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getTerm("commands.general.help.error.description")).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getTerm("commands.general.help.error.description")).queue();
}
}
public void sendHelp(Command cmd, CommandEvent event) {
public void sendHelp(Command cmd, CommandEvent e) {
if (!cmd.getClass().getPackageName().endsWith("owner") || (cmd.getClass().getPackageName().endsWith("owner") &&
(event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().getId().equals("261083609148948488")))) {
(e.getAuthor().getId().equals("477141528981012511") || e.getAuthor().getId().equals("261083609148948488")))) {
String name = cmd.labels()[0];
StringBuilder b = new StringBuilder();
b.append(event.getMessageEditor().getTerm("commands.general.help.description")).append(" ").append(event.getMessageEditor().getTerm(cmd.description())).append("\n");
b.append(e.getMessageEditor().getTerm("commands.general.help.description")).append(" ").append(e.getMessageEditor().getTerm(cmd.description())).append("\n");
if (cmd.usage() != null) {
b.append(event.getMessageEditor().getTerm("commands.general.help.usage")).append(" ").append(event.getRethinkServer().getPrefix()).append(name).append(" ").append(cmd.usage()).append("\n");
}
if (cmd.example() != null) {
b.append(event.getMessageEditor().getTerm("commands.general.help.example")).append(" ").append(event.getRethinkServer().getPrefix()).append(name).append(" ").append(cmd.example());
}
event.getChannel().sendMessage(event.getMessageEditor().getMessage(
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO)
.setTitle(cmd.labels()[0])
.setDescription(b.toString())

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.general;
import com.bbn.hadder.Hadder;
@ -5,16 +21,12 @@ import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
/*
* @author Skidder / GregTCLTK
*/
public class InviteCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.general.invite.success.title",
"",

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.general;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.general;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -11,8 +23,8 @@ import com.bbn.hadder.utils.MessageEditor;
public class PingCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
event.getJDA().getRestPing().queue(ping -> event.getTextChannel().sendMessage(event.getMessageEditor()
public void executed(String[] args, CommandEvent e) {
e.getJDA().getRestPing().queue(ping -> e.getTextChannel().sendMessage(e.getMessageEditor()
.getMessage(MessageEditor.MessageType.INFO)
.setTitle("Ping")
.setDescription(String.valueOf(ping))

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.misc;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.misc;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.EventWaiter;
@ -17,39 +29,39 @@ import java.io.IOException;
public class FeedbackCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.misc.feedback.title.request.title",
"commands.misc.feedback.title.request.description")
.build()).queue();
new EventWaiter().newOnMessageEventWaiter(event1 -> {
String title = event1.getMessage().getContentDisplay();
event1.getChannel().sendMessage(event.getMessageEditor().getMessage(
new EventWaiter().newOnMessageEventWaiter(e1 -> {
String title = e1.getMessage().getContentDisplay();
e1.getChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.misc.feedback.description.request.title",
"commands.misc.feedback.description.request.description")
.build()).queue();
new EventWaiter().newOnMessageEventWaiter(event2 -> {
String description = event2.getMessage().getContentDisplay();
new EventWaiter().newOnMessageEventWaiter(e2 -> {
String description = e2.getMessage().getContentDisplay();
try {
GitHub connection = GitHub.connectUsingOAuth(event.getConfig().getGitHubToken());
GitHub connection = GitHub.connectUsingOAuth(e.getConfig().getGitHubToken());
GHRepository Hadder = connection.getOrganization("BigBotNetwork").getRepository("Hadder");
GHIssue issue = Hadder.createIssue(title).body("<strong>Feedback by " + event.getAuthor().getAsTag() + "</strong><br>" + description).label("feedback").create();
GHIssue issue = Hadder.createIssue(title).body("<strong>Feedback by " + e.getAuthor().getAsTag() + "</strong><br>" + description).label("feedback").create();
issue.addLabels("feedback");
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.misc.feedback.success.title",
"")
.setDescription(issue.getHtmlUrl().toString())
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}, event.getJDA(), event.getAuthor());
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
}, e.getJDA(), e.getAuthor());
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.misc;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.misc;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -18,11 +30,11 @@ import java.io.IOException;
public class GitHubCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
if (args[0].equals("link")) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.misc.github.link.title",
"")
@ -51,39 +63,39 @@ public class GitHubCommand implements Command {
if (!json.getString("blog").equals("")) website = json.getString("blog");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.misc.github.success.title", nickname + " (" + args[0] + ")", ""), "https://github.com/" + args[0] + "", "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.misc.github.success.title", nickname + " (" + args[0] + ")", ""), "https://github.com/" + args[0] + "", "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
.setThumbnail(json.getString("avatar_url"))
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.bio"), bio, false)
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.location"), location, true)
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.website"), website, true)
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.repositories"), String.valueOf(json.getInt("public_repos")), true)
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.gists"), String.valueOf(json.getInt("public_gists")), true)
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.followers"), String.valueOf(json.getInt("followers")), true)
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.following"), String.valueOf(json.getInt("following")), true)
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.bio"), bio, false)
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.location"), location, true)
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.website"), website, true)
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.repositories"), String.valueOf(json.getInt("public_repos")), true)
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.gists"), String.valueOf(json.getInt("public_gists")), true)
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.followers"), String.valueOf(json.getInt("followers")), true)
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.following"), String.valueOf(json.getInt("following")), true)
.build()).queue();
} catch (IOException | NullPointerException e) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
} catch (IOException | NullPointerException ex) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.misc.github.api.error.title",
"commands.misc.github.api.error.description")
.build()
).queue();
} catch (JSONException e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
} catch (JSONException ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.misc.github.user.error.title",
"commands.misc.github.user.error.description").build()).queue();
}
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
/*
TODO: THIS
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.misc.github.connect.title",
"",

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.misc;
import com.bbn.hadder.commands.Command;
@ -14,52 +30,52 @@ import java.util.List;
public class ScreenShareCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length>0) {
if (args[0].matches("[0-9]*") && args.length==1 && args[0].length() == 18) {
if (event.getGuild().getVoiceChannelById(args[0]) != null) {
event.getChannel().sendMessage(event.getMessageEditor().getMessage(
if (e.getGuild().getVoiceChannelById(args[0]) != null) {
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.misc.screenshare.success.title", "")
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + args[0] + "/").build()).queue();
.setDescription("http://discordapp.com/channels/" + e.getGuild().getId() + "/" + args[0] + "/").build()).queue();
} else {
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.id.error.description").build()).queue();
event.getHelpCommand().sendHelp(this, event);
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.id.error.description").build()).queue();
e.getHelpCommand().sendHelp(this, e);
}
} else {
List<VoiceChannel> vcs = event.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
List<VoiceChannel> vcs = e.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
if (vcs.size() > 1) {
EmbedBuilder eb = event.getMessageEditor().getMessage(MessageType.WARNING, "commands.misc.screenshare.channel.error.title", "commands.misc.screenshare.channel.error.description");
EmbedBuilder eb = e.getMessageEditor().getMessage(MessageType.WARNING, "commands.misc.screenshare.channel.error.title", "commands.misc.screenshare.channel.error.description");
for (int i = 0; i < vcs.size(); i++) {
VoiceChannel voiceChannel = vcs.get(i);
eb.addField(i + ": " + voiceChannel.getName(), voiceChannel.getId(), false);
}
event.getChannel().sendMessage(eb.build()).queue();
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
e.getChannel().sendMessage(eb.build()).queue();
new EventWaiter().newOnMessageEventWaiter(msge -> {
try {
int i = Integer.parseInt(msgevent.getMessage().getContentRaw());
int i = Integer.parseInt(msge.getMessage().getContentRaw());
if (vcs.size() > i) {
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
.setDescription("http://discordapp.com/channels/" + e.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
} else {
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.number.error.title", "").build()).queue();
event.getHelpCommand().sendHelp(this, event);
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.number.error.title", "").build()).queue();
e.getHelpCommand().sendHelp(this, e);
}
} catch (NumberFormatException e) {
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.number.error.description").build()).queue();
event.getHelpCommand().sendHelp(this, event);
} catch (NumberFormatException ex) {
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.number.error.description").build()).queue();
e.getHelpCommand().sendHelp(this, e);
}
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
} else if (vcs.size()==0) {
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.channel.existing.error", "commands.misc.screenshare.channel.existing.description").build()).queue();
event.getHelpCommand().sendHelp(this, event);
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.channel.existing.error", "commands.misc.screenshare.channel.existing.description").build()).queue();
e.getHelpCommand().sendHelp(this, e);
} else {
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
.setDescription("http://discordapp.com/channels/" + e.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
}
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.moderation;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -15,68 +27,68 @@ import net.dv8tion.jda.api.entities.Member;
public class BanCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getMessage().getMentionedMembers().size() == 1) {
Member victim = event.getMessage().getMentionedMembers().get(0);
if (!event.getAuthor().getId().equals(victim.getId())) {
if (!event.getJDA().getSelfUser().getId().equals(victim.getId())) {
if (event.getGuild().getSelfMember().canInteract(victim)) {
event.getGuild().ban(victim, 0, "Banned by " + event.getAuthor().getAsTag()).queue();
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
if (e.getMessage().getMentionedMembers().size() == 1) {
Member victim = e.getMessage().getMentionedMembers().get(0);
if (!e.getAuthor().getId().equals(victim.getId())) {
if (!e.getJDA().getSelfUser().getId().equals(victim.getId())) {
if (e.getGuild().getSelfMember().canInteract(victim)) {
e.getGuild().ban(victim, 0, "Banned by " + e.getAuthor().getAsTag()).queue();
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.ban.success.title",
"",
"commands.moderation.ban.success.description",
victim.getUser().getName() + ".").build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.ban.error.title",
"commands.moderation.ban.myself.error.description").build()).queue();
}
} else {
event.getTextChannel().sendMessage
(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage
(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.ban.error.title",
"commands.moderation.ban.yourself.error.description").build()).queue();
}
} else if (event.getMessage().getMentionedMembers().size() == 0) {
event.getHelpCommand().sendHelp(this, event);
} else if (event.getMessage().getMentionedMembers().size() > 1) {
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
Member member = event.getMessage().getMentionedMembers().get(i);
if (!event.getAuthor().getId().equals(member.getId())) {
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
if (event.getGuild().getSelfMember().canInteract(member)) {
event.getGuild().ban(member, 0).reason("Mass Ban by " + event.getAuthor().getAsTag()).queue();
} else if (e.getMessage().getMentionedMembers().size() == 0) {
e.getHelpCommand().sendHelp(this, e);
} else if (e.getMessage().getMentionedMembers().size() > 1) {
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
Member member = e.getMessage().getMentionedMembers().get(i);
if (!e.getAuthor().getId().equals(member.getId())) {
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
if (e.getGuild().getSelfMember().canInteract(member)) {
e.getGuild().ban(member, 0).reason("Mass Ban by " + e.getAuthor().getAsTag()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.ban.error.title",
"commands.moderation.ban.myself.error.description").build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.ban.error.title",
"commands.moderation.ban.yourself.error.description").build()).queue();
}
}
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.moderation.ban.success.title",
"",
"commands.moderation.ban.massban.success.description",
String.valueOf(event.getMessage().getMentionedMembers().size())).build()).queue();
String.valueOf(e.getMessage().getMentionedMembers().size())).build()).queue();
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.moderation;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -20,15 +32,15 @@ import java.util.concurrent.TimeUnit;
public class ClearCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
if (args[0].equals("all")) {
List<Message> msg = event.getTextChannel().getIterableHistory().complete();
List<Message> msg = e.getTextChannel().getIterableHistory().complete();
for (Message message : msg) {
message.delete().queue();
}
Message message = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
Message message = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.clear.all.success.title",
"",
@ -37,51 +49,51 @@ public class ClearCommand implements Command {
.build()).complete();
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
message.delete().queue();
} else {
try {
int nbToDelete = Integer.parseInt(args[0]);
if (nbToDelete < 1 || nbToDelete > 99) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.number.error.title", "commands.moderation.clear.number.error.description").build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.number.error.title", "commands.moderation.clear.number.error.description").build()).queue();
} else {
List<Message> history = event.getTextChannel().getHistory().retrievePast(nbToDelete + 1).complete();
List<Message> history = e.getTextChannel().getHistory().retrievePast(nbToDelete + 1).complete();
List<Message> msgToDelete = new ArrayList<>(history);
event.getTextChannel().deleteMessages(msgToDelete).queue();
e.getTextChannel().deleteMessages(msgToDelete).queue();
if (nbToDelete == 1) {
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title",
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title",
"commands.moderation.clear.success.description.singular").build()).complete();
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
msg.delete().queue();
} else {
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title", "",
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title", "",
"commands.moderation.clear.success.description.plural", String.valueOf(nbToDelete)).build()).complete();
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
msg.delete().queue();
}
}
} catch (NumberFormatException e) {
event.getHelpCommand().sendHelp(this, event);
} catch (IllegalArgumentException e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.message.error.title", "commands.moderation.clear.message.error.description")
} catch (NumberFormatException ex) {
e.getHelpCommand().sendHelp(this, e);
} catch (IllegalArgumentException ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.message.error.title", "commands.moderation.clear.message.error.description")
.build()).queue();
}
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
@ -7,10 +23,6 @@ import com.bbn.hadder.core.Perms;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.entities.TextChannel;
/**
* @author Skidder / GregTCLTK
*/
@Perms(Perm.MANAGE_SERVER)
public class EditRulesCommand implements Command {
@ -21,54 +33,54 @@ public class EditRulesCommand implements Command {
"commands.moderation.editrules.message.title",
"commands.moderation.editrules.message.description").build()).queue();
event.getEventWaiter().newOnMessageEventWaiter(event1 -> {
String rules = event1.getMessage().getContentRaw();
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
e.getEventWaiter().newOnMessageEventWaiter(e1 -> {
String rules = e1.getMessage().getContentRaw();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.moderation.editrules.channel.title",
"commands.moderation.editrules.channel.description").build()).queue();
event.getEventWaiter().newOnMessageEventWaiter(event2 -> {
if (event2.getMessage().getMentionedChannels().size() == 1) {
e.getEventWaiter().newOnMessageEventWaiter(e2 -> {
if (e2.getMessage().getMentionedChannels().size() == 1) {
try {
TextChannel channel = event2.getMessage().getMentionedChannels().get(0);
checkChannel(event, rules, channel);
} catch (Exception e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
TextChannel channel = e2.getMessage().getMentionedChannels().get(0);
checkChannel(e, rules, channel);
} catch (Exception ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.editrules.channel.error.title",
"commands.moderation.editrules.channel.error.description")
.build()).queue();
}
} else {
try {
TextChannel channel = event1.getGuild().getTextChannelsByName(event2.getMessage().getContentRaw(), true).get(0);
checkChannel(event, rules, channel);
} catch (Exception e) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
TextChannel channel = e1.getGuild().getTextChannelsByName(e2.getMessage().getContentRaw(), true).get(0);
checkChannel(e, rules, channel);
} catch (Exception ex) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.editrules.channel.error.title",
"commands.moderation.editrules.channel.error.description")
.build()).queue();
}
}
}, event.getJDA(), event.getAuthor());
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
}, e.getJDA(), e.getAuthor());
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.editrules.error.title", "",
"commands.moderation.editrules.error.description", event.getRethinkServer().getPrefix()).build()).queue();
}
}
public void checkChannel(CommandEvent event, String rules, TextChannel channel) {
public void checkChannel(CommandEvent e, String rules, TextChannel channel) {
try {
channel.retrieveMessageById(event.getRethinkServer().getMessage_id()).queue();
setRules(event, rules, channel);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.moderation.editrules.success.title",
"commands.moderation.editrules.success.description").build()).queue();
} catch (Exception e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
} catch (Exception ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.editrules.channel.message.error.title",
"commands.moderation.editrules.channel.message.error.description").build()).queue();
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.moderation;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -14,7 +26,7 @@ import com.bbn.hadder.utils.MessageEditor;
public class InviteDetectCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length == 1) {
String opinion = args[0].toLowerCase();
switch (opinion) {
@ -29,7 +41,7 @@ public class InviteDetectCommand implements Command {
.build()).queue();
event.getRethinkServer().push();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.invitedetect.activate.error.title",
"commands.moderation.invitedetect.activate.error.description")
@ -47,7 +59,7 @@ public class InviteDetectCommand implements Command {
.build()).queue();
event.getRethinkServer().push();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.invitedetect.deactivate.error.title",
"commands.moderation.invitedetect.deactivate.error.description")
@ -55,10 +67,10 @@ public class InviteDetectCommand implements Command {
}
break;
default:
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.moderation;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -15,53 +27,53 @@ import net.dv8tion.jda.api.entities.Member;
public class KickCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getMessage().getMentionedMembers().size() == 1) {
Member victim = event.getMessage().getMentionedMembers().get(0);
if (!event.getAuthor().getId().equals(victim.getId())) {
if (!event.getJDA().getSelfUser().getId().equals(victim.getId())) {
if (event.getGuild().getSelfMember().canInteract(victim)) {
event.getGuild().kick(victim, "Kicked by " + event.getAuthor().getAsTag()).queue();
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
if (e.getMessage().getMentionedMembers().size() == 1) {
Member victim = e.getMessage().getMentionedMembers().get(0);
if (!e.getAuthor().getId().equals(victim.getId())) {
if (!e.getJDA().getSelfUser().getId().equals(victim.getId())) {
if (e.getGuild().getSelfMember().canInteract(victim)) {
e.getGuild().kick(victim, "Kicked by " + e.getAuthor().getAsTag()).queue();
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.kick.success.title",
"",
"commands.moderation.kick.success.description",
victim.getUser().getName()).build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.kick.error.title",
"commands.moderation.kick.myself.error.description").build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
}
} else if (event.getMessage().getMentionedMembers().size() == 0) {
event.getHelpCommand().sendHelp(this, event);
} else if (event.getMessage().getMentionedMembers().size() > 1) {
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
Member member = event.getMessage().getMentionedMembers().get(i);
if (!event.getAuthor().getId().equals(member.getId())) {
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
if (event.getGuild().getSelfMember().canInteract(member)) {
event.getGuild().kick(member).reason("Mass Kicked by " + event.getAuthor().getAsTag()).queue();
} else if (e.getMessage().getMentionedMembers().size() == 0) {
e.getHelpCommand().sendHelp(this, e);
} else if (e.getMessage().getMentionedMembers().size() > 1) {
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
Member member = e.getMessage().getMentionedMembers().get(i);
if (!e.getAuthor().getId().equals(member.getId())) {
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
if (e.getGuild().getSelfMember().canInteract(member)) {
e.getGuild().kick(member).reason("Mass Kicked by " + e.getAuthor().getAsTag()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.myself.error.description").build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.myself.error.description").build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
}
}
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.kick.success.title", "", "commands.moderation.kick.masskick.success.description", String.valueOf(event.getMessage().getMentionedMembers().size())).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.kick.success.title", "", "commands.moderation.kick.masskick.success.description", String.valueOf(e.getMessage().getMentionedMembers().size())).build()).queue();
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.moderation;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -16,11 +28,11 @@ import net.dv8tion.jda.api.entities.Member;
public class NickCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getSelfMember().hasPermission(Permission.NICKNAME_MANAGE)) {
if (event.getMessage().getMentionedMembers().size() == 1) {
if (!event.getMessage().getMentionedMembers().get(0).getId().equals(event.getGuild().getSelfMember().getId())) {
if (event.getGuild().getSelfMember().canInteract(event.getMessage().getMentionedMembers().get(0))) {
public void executed(String[] args, CommandEvent e) {
if (e.getGuild().getSelfMember().hasPermission(Permission.NICKNAME_MANAGE)) {
if (e.getMessage().getMentionedMembers().size() == 1) {
if (!e.getMessage().getMentionedMembers().get(0).getId().equals(e.getGuild().getSelfMember().getId())) {
if (e.getGuild().getSelfMember().canInteract(e.getMessage().getMentionedMembers().get(0))) {
if (args.length > 1) {
if (event.getMessage().getContentRaw().startsWith(event.getRethinkUser().getPrefix())) {
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethinkUser().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
@ -30,7 +42,7 @@ public class NickCommand implements Command {
"commands.moderation.nick.success.title",
"",
"commands.moderation.nick.success.description",
event.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
e.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
).build()).queue();
} else if (event.getMessage().getContentRaw().startsWith(event.getRethinkServer().getPrefix())) {
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethinkServer().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
@ -39,14 +51,14 @@ public class NickCommand implements Command {
MessageEditor.MessageType.INFO,
"commands.moderation.nick.success.title",
"",
"commands.moderation.nick.success.description", event.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
"commands.moderation.nick.success.description", e.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
).build()).queue();
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
if (event.getMessage().getContentRaw().startsWith(event.getRethinkUser().getPrefix())) {
@ -69,27 +81,27 @@ public class NickCommand implements Command {
).build()).queue();
}
}
} else if (event.getMessage().getMentionedMembers().size() == 0) {
event.getHelpCommand().sendHelp(this, event);
} else if (e.getMessage().getMentionedMembers().size() == 0) {
e.getHelpCommand().sendHelp(this, e);
} else {
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
Member member = event.getMessage().getMentionedMembers().get(i);
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
event.getGuild().modifyNickname(member, args[args.length - 1]).reason("Mass Nicked by " + event.getAuthor().getAsTag()).queue();
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
Member member = e.getMessage().getMentionedMembers().get(i);
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
e.getGuild().modifyNickname(member, args[args.length - 1]).reason("Mass Nicked by " + e.getAuthor().getAsTag()).queue();
} else {
event.getGuild().getSelfMember().modifyNickname(args[args.length - 1]).reason("Mass Nicked by " + event.getAuthor().getAsTag()).queue();
e.getGuild().getSelfMember().modifyNickname(args[args.length - 1]).reason("Mass Nicked by " + e.getAuthor().getAsTag()).queue();
}
}
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.nick.success.title",
"",
"commands.moderation.nick.myself.success.description", String.valueOf(event.getMessage().getMentionedMembers().size())
"commands.moderation.nick.myself.success.description", String.valueOf(e.getMessage().getMentionedMembers().size())
).build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
}

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
@ -10,7 +26,7 @@ import com.bbn.hadder.utils.MessageEditor;
public class PrefixCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length == 1) {
if (!args[0].contains("\"")) {
event.getRethinkServer().setPrefix(args[0]);
@ -23,14 +39,14 @@ public class PrefixCommand implements Command {
args[0]).build()
).queue();
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.WARNING,
"",
"commands.moderation.prefix.error.description").build()).queue();
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.moderation;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -16,67 +28,67 @@ import net.dv8tion.jda.api.Region;
public class RegionChangeCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length == 1) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER)) {
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER)) {
switch (args[0].toLowerCase()) {
case "amsterdam":
setRegion(Region.AMSTERDAM, "Amsterdam", event);
setRegion(Region.AMSTERDAM, "Amsterdam", e);
break;
case "frankfurt":
setRegion(Region.FRANKFURT, "Frankfurt", event);
setRegion(Region.FRANKFURT, "Frankfurt", e);
break;
case "eu-west":
setRegion(Region.EU_WEST, "EU West", event);
setRegion(Region.EU_WEST, "EU West", e);
break;
case "eu-central":
setRegion(Region.EU_CENTRAL, "EU Central", event);
setRegion(Region.EU_CENTRAL, "EU Central", e);
break;
case "europe":
setRegion(Region.EUROPE, "EUROPE", event);
setRegion(Region.EUROPE, "EUROPE", e);
break;
case "brazil":
setRegion(Region.BRAZIL, "Brazil", event);
setRegion(Region.BRAZIL, "Brazil", e);
break;
case "hongkong":
setRegion(Region.HONG_KONG, "Hong Kong", event);
setRegion(Region.HONG_KONG, "Hong Kong", e);
break;
case "india":
setRegion(Region.INDIA, "India", event);
setRegion(Region.INDIA, "India", e);
break;
case "japan":
setRegion(Region.JAPAN, "Japan", event);
setRegion(Region.JAPAN, "Japan", e);
break;
case "london":
setRegion(Region.LONDON, "London", event);
setRegion(Region.LONDON, "London", e);
break;
case "russia":
setRegion(Region.RUSSIA, "Russia", event);
setRegion(Region.RUSSIA, "Russia", e);
break;
case "singapore":
setRegion(Region.SINGAPORE, "Singapore", event);
setRegion(Region.SINGAPORE, "Singapore", e);
break;
case "south-africa":
setRegion(Region.SOUTH_AFRICA, "South Africa", event);
setRegion(Region.SOUTH_AFRICA, "South Africa", e);
break;
case "sydney":
setRegion(Region.SYDNEY, "Sydney", event);
setRegion(Region.SYDNEY, "Sydney", e);
break;
case "us-central":
setRegion(Region.US_CENTRAL, "US Central", event);
setRegion(Region.US_CENTRAL, "US Central", e);
break;
case "us-east":
setRegion(Region.US_EAST, "US East", event);
setRegion(Region.US_EAST, "US East", e);
break;
case "us-west":
setRegion(Region.US_WEST, "US West", event);
setRegion(Region.US_WEST, "US West", e);
break;
case "us-south":
setRegion(Region.US_SOUTH, "US South", event);
setRegion(Region.US_SOUTH, "US South", e);
break;
default:
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.regionchange.regions.title",
"")
@ -84,10 +96,12 @@ public class RegionChangeCommand implements Command {
.build()).queue();
break;
}
//TODO: Maybe South Korea. Check the geo restricted discussion
} else
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
} else event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
} else e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.regionchange.regions.title",
"")
@ -95,10 +109,10 @@ public class RegionChangeCommand implements Command {
.build()).queue();
}
public void setRegion (Region region, String region_name, CommandEvent event) {
event.getGuild().getManager().setRegion(region).reason("Region changed by " + event.getAuthor().getAsTag()).queue();
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
public void setRegion (Region region, String region_name, CommandEvent e) {
e.getGuild().getManager().setRegion(region).reason("Region changed by " + e.getAuthor().getAsTag()).queue();
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.regionchange.success.title", "",
"commands.moderation.regionchange.success.description", region_name)

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
@ -13,74 +29,74 @@ import net.dv8tion.jda.api.entities.Role;
public class RoleCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
switch (args[0].toLowerCase()) {
case "add":
if (event.getMessage().getMentionedMembers().size() > 0 && event.getMessage().getMentionedRoles().size() > 0) {
for (Member member : event.getMessage().getMentionedMembers()) {
for (Role role : event.getMessage().getMentionedRoles()) {
if (event.getGuild().getSelfMember().canInteract(member)) {
if (event.getGuild().getSelfMember().canInteract(role)) {
event.getGuild().addRoleToMember(member, role).reason("Role added by " + event.getAuthor().getAsTag()).queue();
if (e.getMessage().getMentionedMembers().size() > 0 && e.getMessage().getMentionedRoles().size() > 0) {
for (Member member : e.getMessage().getMentionedMembers()) {
for (Role role : e.getMessage().getMentionedRoles()) {
if (e.getGuild().getSelfMember().canInteract(member)) {
if (e.getGuild().getSelfMember().canInteract(role)) {
e.getGuild().addRoleToMember(member, role).reason("Role added by " + e.getAuthor().getAsTag()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
}
}
event.getChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.role.add.success.title",
"",
"",
"commands.moderation.role.add.success.description",
String.valueOf(event.getMessage().getMentionedRoles().size()),
String.valueOf(event.getMessage().getMentionedMembers().size()))
String.valueOf(e.getMessage().getMentionedRoles().size()),
String.valueOf(e.getMessage().getMentionedMembers().size()))
.build()).queue();
}
break;
case "remove":
if (event.getMessage().getMentionedMembers().size() > 0 && event.getMessage().getMentionedRoles().size() > 0) {
for (Member member : event.getMessage().getMentionedMembers()) {
for (Role role : event.getMessage().getMentionedRoles()) {
if (event.getGuild().getSelfMember().canInteract(member)) {
if (event.getGuild().getSelfMember().canInteract(role)) {
event.getGuild().removeRoleFromMember(member, role).reason("Role removed by " + event.getAuthor().getAsTag()).queue();
if (e.getMessage().getMentionedMembers().size() > 0 && e.getMessage().getMentionedRoles().size() > 0) {
for (Member member : e.getMessage().getMentionedMembers()) {
for (Role role : e.getMessage().getMentionedRoles()) {
if (e.getGuild().getSelfMember().canInteract(member)) {
if (e.getGuild().getSelfMember().canInteract(role)) {
e.getGuild().removeRoleFromMember(member, role).reason("Role removed by " + e.getAuthor().getAsTag()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
}
}
event.getChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.role.remove.success.title",
"",
"",
"commands.moderation.role.remove.success.description",
String.valueOf(event.getMessage().getMentionedRoles().size()),
String.valueOf(event.getMessage().getMentionedMembers().size()))
String.valueOf(e.getMessage().getMentionedRoles().size()),
String.valueOf(e.getMessage().getMentionedMembers().size()))
.build()).queue();
}
break;
default:
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
break;
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.moderation;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -21,92 +33,92 @@ import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
public class RulesCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.setup.title",
"commands.moderation.rules.setup.description")
.build()).queue();
event.getEventWaiter().newOnMessageEventWaiter(event1 -> {
if (event1.getMessage().getMentionedChannels().size() == 1) {
e.getEventWaiter().newOnMessageEventWaiter(e1 -> {
if (e1.getMessage().getMentionedChannels().size() == 1) {
try {
TextChannel channel = event1.getMessage().getMentionedChannels().get(0);
createRules(event, event1, channel);
} catch (Exception e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
TextChannel channel = e1.getMessage().getMentionedChannels().get(0);
createRules(e, e1, channel);
} catch (Exception ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.rules.channel.error.title",
"commands.moderation.rules.channel.error.description")
.build()).queue();
}
} else {
try {
TextChannel channel = event1.getGuild().getTextChannelsByName(event1.getMessage().getContentRaw(), true).get(0);
createRules(event, event1, channel);
} catch (Exception e) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
TextChannel channel = e1.getGuild().getTextChannelsByName(e1.getMessage().getContentRaw(), true).get(0);
createRules(e, e1, channel);
} catch (Exception ex) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.rules.channel.error.title",
"commands.moderation.rules.channel.error.description")
.build()).queue();
}
}
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.rules.error.permission.title",
"commands.moderation.rules.error.permission.description")
.build()).queue();
}
}
public void createRules(CommandEvent event, GuildMessageReceivedEvent event1, TextChannel channel) {
if (channel.getGuild().getId().equals(event1.getGuild().getId())) {
if (event.getGuild().getSelfMember().hasPermission(channel, Permission.MESSAGE_WRITE)) {
event1.getChannel().sendMessage(
event.getMessageEditor().getMessage(
public void createRules(CommandEvent e, GuildMessageReceivedEvent e1, TextChannel channel) {
if (channel.getGuild().getId().equals(e1.getGuild().getId())) {
if (e.getGuild().getSelfMember().hasPermission(channel, Permission.MESSAGE_WRITE)) {
e1.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.rules.title",
"",
"commands.moderation.rules.rules.description",
channel.getName())
.build()).queue();
event.getEventWaiter().newOnMessageEventWaiter(event2 -> {
String message = event2.getMessage().getContentRaw();
event2.getChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getEventWaiter().newOnMessageEventWaiter(e2 -> {
String message = e2.getMessage().getContentRaw();
e2.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.role.title",
"commands.moderation.rules.role.description")
.build()).queue();
new EventWaiter().newOnMessageEventWaiter(event3 -> {
if (event3.getMessage().getMentionedRoles().size() == 1) {
Role role = event3.getMessage().getMentionedRoles().get(0);
setRole(event, channel, message, event3, role);
} else if (event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).size() > 0) {
Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).get(0);
setRole(event, channel, message, event3, role);
new EventWaiter().newOnMessageEventWaiter(e3 -> {
if (e3.getMessage().getMentionedRoles().size() == 1) {
Role role = e3.getMessage().getMentionedRoles().get(0);
setRole(e, channel, message, e3, role);
} else if (e3.getGuild().getRolesByName(e3.getMessage().getContentRaw(), true).size() > 0) {
Role role = e3.getGuild().getRolesByName(e3.getMessage().getContentRaw(), true).get(0);
setRole(e, channel, message, e3, role);
} else {
event3.getChannel().sendMessage(
event.getMessageEditor().getMessage(
e3.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.rules.role.error.title",
"commands.moderation.rules.role.error.description")
.build()).queue();
}
}, event.getJDA(), event.getAuthor());
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
}, e.getJDA(), e.getAuthor());
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.rules.error.message.title",
"commands.moderation.rules.error.message.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.rules.guild.error.title",
"commands.moderation.rules.guild.error.description")
@ -114,119 +126,119 @@ public class RulesCommand implements Command {
}
}
public void setRole(CommandEvent event, TextChannel channel, String message, GuildMessageReceivedEvent event3, Role role) {
if (event3.getGuild().getSelfMember().canInteract(role)) {
if (event3.getMember().canInteract(role)) {
event3.getChannel().sendMessage(
event.getMessageEditor().getMessage(
public void setRole(CommandEvent e, TextChannel channel, String message, GuildMessageReceivedEvent e3, Role role) {
if (e3.getGuild().getSelfMember().canInteract(role)) {
if (e3.getMember().canInteract(role)) {
e3.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.emote.accept.title",
"",
"commands.moderation.rules.emote.accept.description", role.getName())
.build()).queue();
event.getEventWaiter().newOnMessageEventWaiter(event4 -> {
if (event4.getMessage().getEmotes().size() == 1) {
Emote aemote = event4.getMessage().getEmotes().get(0);
event4.getChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getEventWaiter().newOnMessageEventWaiter(e4 -> {
if (e4.getMessage().getEmotes().size() == 1) {
Emote aemote = e4.getMessage().getEmotes().get(0);
e4.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.emote.decline.title", "",
"commands.moderation.rules.emote.decline.description", String.valueOf(aemote))
.build()).queue();
event.getEventWaiter().newOnMessageEventWaiter(event5 -> {
Emote demote = event5.getMessage().getEmotes().get(0);
e.getEventWaiter().newOnMessageEventWaiter(e5 -> {
Emote demote = e5.getMessage().getEmotes().get(0);
if (!aemote.equals(demote)) {
Message rules = channel.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
Message rules = channel.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setTitle("Rules")
.setDescription(message)
.build()).complete();
try {
rules.addReaction(aemote).queue();
rules.addReaction(demote).queue();
event5.getChannel().sendMessage(
event.getMessageEditor().getMessage(
e5.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.success.title",
"",
"commands.moderation.rules.success.description",
channel.getAsMention())
.build()).queue();
} catch (Exception e) {
event5.getChannel().sendMessage(
event.getMessageEditor().getMessage(
} catch (Exception ex) {
e5.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"error",
"commands.moderation.rules.emote.error.access.description")
.build()).queue();
e.printStackTrace();
ex.printStackTrace();
}
event.getRethinkServer().updateRules(rules.getId(), role.getId(), aemote.toString(), demote.toString());
event.getRethinkServer().push();
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.rules.emote.error.equal.title",
"commands.moderation.rules.emote.error.equal.description")
.build()).queue();
}
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
} else {
String aemote = event4.getMessage().getContentRaw();
event4.getChannel().sendMessage(
event.getMessageEditor().getMessage(
String aemote = e4.getMessage().getContentRaw();
e4.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.emote.decline.title",
"commands.moderation.rules.emoji.decline.description")
.build()).queue();
event.getEventWaiter().newOnMessageEventWaiter(event5 -> {
String demote = event5.getMessage().getContentRaw();
e.getEventWaiter().newOnMessageEventWaiter(e5 -> {
String demote = e5.getMessage().getContentRaw();
if (!aemote.equals(demote)) {
Message rules = channel.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
Message rules = channel.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setTitle("Rules")
.setDescription(message)
.build()).complete();
try {
rules.addReaction(aemote).queue();
rules.addReaction(demote).queue();
event5.getChannel().sendMessage(
event.getMessageEditor().getMessage(
e5.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.moderation.rules.success.title",
"",
"commands.moderation.rules.success.description",
channel.getAsMention())
.build()).queue();
} catch (Exception e) {
event5.getChannel().sendMessage(
event.getMessageEditor().getMessage(
} catch (Exception ex) {
e5.getChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"error",
"commands.moderation.rules.emoji.error.description")
.build()).queue();
e.printStackTrace();
ex.printStackTrace();
}
event.getRethinkServer().updateRules(rules.getId(), role.getId(), aemote, demote);
event.getRethinkServer().push();
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.moderation.rules.emote.error.equal.title",
"commands.moderation.rules.emote.error.equal.description")
.build()).queue();
}
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
}
}, event.getJDA(), event.getAuthor());
}, e.getJDA(), e.getAuthor());
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.rules.role.permission.error.title",
"commands.moderation.rules.role.permission.error.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.rules.error.interact.title",
"commands.moderation.rules.error.interact.description")
.build()).queue();

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.moderation;
import com.bbn.hadder.commands.Command;
@ -19,12 +35,12 @@ public class StarboardCommand implements Command {
.queue();
} else {
if (args.length>0) {
TextChannel channel = event.getGuild().getTextChannelById(args[0]);
TextChannel channel = e.getGuild().getTextChannelById(args[0]);
if (channel!=null) {
event.getRethinkServer().setStarboard(channel.getId());
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,5 +1,17 @@
/*
@author Hax / Hax6775 / Schlauer_Hax
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
@ -14,29 +26,29 @@ public class BassCommand implements Command {
-0.1f, -0.1f, -0.1f, -0.1f };
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
float value = Float.parseFloat(args[0]);
EqualizerFactory equalizer = new EqualizerFactory();
for (int i = 0; i < BASS_BOOST.length; i++) {
equalizer.setGain(i, BASS_BOOST[i] + value);
}
event.getAudioManager().getPlayer(event.getGuild()).setFrameBufferDuration(500);
event.getAudioManager().getPlayer(event.getGuild()).setFilterFactory(equalizer);
e.getAudioManager().getPlayer(e.getGuild()).setFrameBufferDuration(500);
e.getAudioManager().getPlayer(e.getGuild()).setFilterFactory(equalizer);
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.bass.error.connected.title",
"commands.music.bass.error.connected.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.info.error.title",
"commands.music.info.error.description").build()).queue();
}
} else event.getHelpCommand().sendHelp(this, event);
} else e.getHelpCommand().sendHelp(this, e);
}
@Override

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
@ -5,24 +21,20 @@ import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
/**
* @author Skidder / GregTCLTK
*/
public class InfoCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
AudioTrack track = event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack();
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
public void executed(String[] args, CommandEvent e) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
AudioTrack track = e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.info.success.title", "")
.setAuthor(track.getInfo().author)
.addField("Title", track.getInfo().title, true)
.addField("Progress", "`[ " + event.getAudioManager().getTimestamp(track.getPosition()) + " / " + event.getAudioManager().getTimestamp(track.getInfo().length) + " ]`", false)
.addField("Progress", "`[ " + e.getAudioManager().getTimestamp(track.getPosition()) + " / " + e.getAudioManager().getTimestamp(track.getInfo().length) + " ]`", false)
.build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.info.error.title",
"commands.music.info.error.description").build()).queue();
}

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
@ -7,39 +23,35 @@ import net.dv8tion.jda.api.entities.VoiceChannel;
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
import net.dv8tion.jda.api.managers.AudioManager;
/*
* @author Skidder / GregTCLTK
*/
public class JoinCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getMember().getVoiceState().inVoiceChannel()) {
AudioManager audioManager = event.getGuild().getAudioManager();
public void executed(String[] args, CommandEvent e) {
if (e.getMember().getVoiceState().inVoiceChannel()) {
AudioManager audioManager = e.getGuild().getAudioManager();
if(!audioManager.isAttemptingToConnect()) {
VoiceChannel vc = event.getMember().getVoiceState().getChannel();
if (event.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
if (!event.getGuild().getSelfMember().getVoiceState().getChannel().getId().equals(vc.getId())) {
VoiceChannel vc = e.getMember().getVoiceState().getChannel();
if (e.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
if (!e.getGuild().getSelfMember().getVoiceState().getChannel().getId().equals(vc.getId())) {
try {
event.getGuild().getAudioManager().openAudioConnection(vc);
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getGuild().getAudioManager().openAudioConnection(vc);
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.music.join.success.title",
"",
"commands.music.join.success.description",
vc.getName())
.build()).queue();
} catch (InsufficientPermissionException e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
} catch (InsufficientPermissionException ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.join.error.permission.title",
"commands.music.join.error.permission.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.WARNING,
"commands.music.join.error.connecting.already.title",
"commands.music.join.error.connecting.already.description")
@ -47,28 +59,28 @@ public class JoinCommand implements Command {
}
} else {
try {
event.getGuild().getAudioManager().openAudioConnection(vc);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getGuild().getAudioManager().openAudioConnection(vc);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.music.join.success.title", "",
"commands.music.join.success.description", vc.getName())
.build()).queue();
} catch (InsufficientPermissionException e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
} catch (InsufficientPermissionException ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.join.error.permission.title",
"commands.music.join.error.permission.description")
.build()).queue();
}
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.WARNING,
"commands.music.join.error.connecting.trying.title",
"commands.music.join.error.connecting.trying.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.music.join.error.channel.title",
"commands.music.join.error.channel.description")

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.music;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -11,23 +23,23 @@ import com.bbn.hadder.utils.MessageEditor;
public class LeaveCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
event.getGuild().getAudioManager().closeAudioConnection();
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
public void executed(String[] args, CommandEvent e) {
if (e.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
e.getGuild().getAudioManager().closeAudioConnection();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.music.leave.success.title",
"commands.music.leave.success.description")
.build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.leave.error.channel.title",
"commands.music.leave.error.channel.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.music.leave.error.connected.tile",
"commands.music.leave.error.connected.description")

View file

@ -1,34 +1,46 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
/**
* @author Skidder / GregTCLTK
*/
public class LoopCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
if (event.getAudioManager().getTrackManager(event.getGuild()).isLoop()) {
event.getAudioManager().getTrackManager(event.getGuild()).setLoop(false);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue();
public void executed(String[] args, CommandEvent e) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
if (e.getAudioManager().getTrackManager(e.getGuild()).isLoop()) {
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(false);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue();
} else {
event.getAudioManager().getTrackManager(event.getGuild()).setLoop(true);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue();
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(true);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.loop.error.connected.title",
"commands.music.loop.error.connected.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.info.error.title",
"commands.music.info.error.description").build()).queue();
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.music;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -11,29 +23,29 @@ import com.bbn.hadder.utils.MessageEditor;
public class PauseCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
if (!event.getAudioManager().getPlayer(event.getGuild()).isPaused()) {
event.getAudioManager().getPlayer(event.getGuild()).setPaused(true);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
public void executed(String[] args, CommandEvent e) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
if (!e.getAudioManager().getPlayer(e.getGuild()).isPaused()) {
e.getAudioManager().getPlayer(e.getGuild()).setPaused(true);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.pause.success.title",
"commands.music.pause.success.description")
.build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.pause.error.paused.title",
"commands.music.pause.error.paused.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.pause.error.connected.title",
"commands.music.pause.error.connected.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.info.error.title",
"commands.music.info.error.description").build()).queue();
}

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
@ -8,55 +24,51 @@ import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
import java.net.URL;
/**
* @author Skidder / GregTCLTK
*/
public class PlayCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
if (event.getMember().getVoiceState().inVoiceChannel()) {
String input = event.getMessage().getContentRaw().replaceFirst(event.getRethinkServer().getPrefix() + "play ", "").replaceFirst(event.getRethinkUser().getPrefix() + "play ", "");
try {
new URL(input).toURI();
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.play.load.title", "",
"commands.music.play.load.description", "").build()).complete();
event.getAudioManager().loadTrack(input, event, msg);
} catch (InsufficientPermissionException e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getAudioManager().loadTrack(input, e, msg);
} catch (InsufficientPermissionException ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.join.error.permission.title",
"commands.music.join.error.permission.description")
.build()).queue();
} catch (Exception ignore) {
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.play.load.title", "",
"commands.music.play.load.description", "").build()).complete();
event.getAudioManager().loadTrack("ytsearch: " + input, event, msg);
e.getAudioManager().loadTrack("ytsearch: " + input, e, msg);
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.music.join.error.channel.title",
"commands.music.join.error.channel.description")
.build()).queue();
}
} else if (event.getAudioManager().getPlayer(event.getGuild()).isPaused()) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
event.getAudioManager().getPlayer(event.getGuild()).setPaused(false);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
} else if (e.getAudioManager().getPlayer(e.getGuild()).isPaused()) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
e.getAudioManager().getPlayer(e.getGuild()).setPaused(false);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.play.success.unpause.title",
"commands.music.play.success.unpause.description")
.build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.play.error.connected.title",
"commands.music.play.error.connected.description")
.build()).queue();
}
} else event.getHelpCommand().sendHelp(this, event);
} else e.getHelpCommand().sendHelp(this, e);
}
@Override

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.audio.AudioInfo;
@ -7,29 +23,25 @@ import com.bbn.hadder.utils.MessageEditor;
import java.util.Set;
/**
* @author Skidder / GregTCLTK
*/
public class QueueCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (!event.getAudioManager().hasPlayer(event.getGuild()) || event.getAudioManager().getTrackManager(event.getGuild()).getQueuedTracks().isEmpty()) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
public void executed(String[] args, CommandEvent e) {
if (!e.getAudioManager().hasPlayer(e.getGuild()) || e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.queue.error.title",
"commands.music.queue.error.description"
).build()).queue();
} else {
Set<AudioInfo> queue = event.getAudioManager().getTrackManager(event.getGuild()).getQueuedTracks();
Set<AudioInfo> queue = e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks();
StringBuilder builder = new StringBuilder();
long queuelength = 0;
for (AudioInfo g : queue) {
queuelength = queuelength + g.getTrack().getInfo().length;
builder.append("("+event.getAudioManager().getTimestamp(g.getTrack().getInfo().length)+") **").append(g.getTrack().getInfo().author).append("**: `").append(g.getTrack().getInfo().title).append("` \n");
builder.append("("+e.getAudioManager().getTimestamp(g.getTrack().getInfo().length)+") **").append(g.getTrack().getInfo().author).append("**: `").append(g.getTrack().getInfo().title).append("` \n");
}
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.queue.success.title", "("+String.valueOf(event.getAudioManager().getTimestamp(queuelength))+")",
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.queue.success.title", "("+String.valueOf(e.getAudioManager().getTimestamp(queuelength))+")",
"commands.music.queue.success.description", builder.toString())
.build()).queue();
}

View file

@ -1,30 +1,42 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
/**
* @author Skidder / GregTCLTK
*/
public class SkipCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && !event.getAudioManager().getTrackManager(event.getGuild()).getQueuedTracks().isEmpty()) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
event.getAudioManager().forceSkipTrack(event);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
public void executed(String[] args, CommandEvent e) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && !e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
e.getAudioManager().forceSkipTrack(e);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.skip.success.title",
"commands.music.skip.success.description").build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.skip.error.connected.title",
"commands.music.skip.error.connected.description ").build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.info.error.title",
"commands.music.info.error.description").build()).queue();
}

View file

@ -1,34 +1,46 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
/**
* @author Skidder / GregTCLTK
*/
public class StopCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
event.getAudioManager().players.remove(event.getGuild().getId());
event.getAudioManager().getPlayer(event.getGuild()).destroy();
event.getAudioManager().getTrackManager(event.getGuild()).purgeQueue();
event.getGuild().getAudioManager().closeAudioConnection();
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
public void executed(String[] args, CommandEvent e) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
e.getAudioManager().players.remove(e.getGuild().getId());
e.getAudioManager().getPlayer(e.getGuild()).destroy();
e.getAudioManager().getTrackManager(e.getGuild()).purgeQueue();
e.getGuild().getAudioManager().closeAudioConnection();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.stop.success.title",
"commands.music.stop.success.description").build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.stop.error.connected.title",
"commands.music.stop.error.connected.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.info.error.title",
"commands.music.info.error.description").build()).queue();
}

View file

@ -1,49 +1,59 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
/**
* @author Skidder / GregTCLTK
*/
public class VolumeCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
try {
int volume = Integer.parseInt(args[0]);
if (volume < 201 && volume > 0 || event.getConfig().getOwners().contains(event.getAuthor().getIdLong())) {
event.getAudioManager().getPlayer(event.getGuild()).setVolume(volume);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
if (volume < 201 && volume > 0 || e.getConfig().getOwners().contains(e.getAuthor().getIdLong())) {
e.getAudioManager().getPlayer(e.getGuild()).setVolume(volume);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.volume.success.title", "",
"commands.music.volume.success.description", String.valueOf(volume)).build()).queue();
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.volume.error.int.title",
"commands.music.volume.error.int.description").build()).queue();
}
} catch (NumberFormatException e) {
event.getHelpCommand().sendHelp(this, event);
} catch (Exception e) {
e.printStackTrace();
} catch (NumberFormatException ex) {
e.getHelpCommand().sendHelp(this, e);
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.volume.error.connected.title",
"commands.music.volume.error.connected.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.info.error.title",
"commands.music.info.error.description").build()).queue();
}
} else event.getHelpCommand().sendHelp(this, event);
} else e.getHelpCommand().sendHelp(this, e);
}
@Override

View file

@ -1,47 +1,39 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class AnalCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/anal/").build();
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/anal/");
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Anal")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,47 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class BDSMCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/img/bdsm_lewd").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/img/bdsm_lewd");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("BDSM")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,44 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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 java.io.IOException;
import com.bbn.hadder.utils.Request;
public class BlowjobCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/blowjob").build();
String url = Request.get("https://nekos.life/api/v2/img/blowjob");
try {
Response response = caller.newCall(request).execute();
String url = response.body().string().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Blowjob")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,48 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class BoobsCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/tits/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/tits/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Boobs")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,48 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class CumCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/cum/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/cum/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Cum")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,44 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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 java.io.IOException;
import com.bbn.hadder.utils.Request;
public class EroticCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/erok").build();
String url = Request.get("https://nekos.life/api/v2/img/erok");
try {
Response response = caller.newCall(request).execute();
String url = response.body().string().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Erotic")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,48 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class FeetCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/feet/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/feet/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Feet")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,48 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class FingeringCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/pussy_wank/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/pussy_wank/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Fingering")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,48 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class LickingCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/kuni/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/kuni/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Licking")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,48 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class PornCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/classic/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/classic/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Porn")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,44 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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 java.io.IOException;
import com.bbn.hadder.utils.Request;
public class PussyCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/pussy").build();
String url = Request.get("https://nekos.life/api/v2/img/pussy/");
try {
Response response = caller.newCall(request).execute();
String url = response.body().string().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Pussy")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,51 +1,44 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class RandomPornCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/all_tags/")
.build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/all_tags/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel()
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
url.replace("\"}", ""))
.setImage(url.replace("\"}", "")).setFooter("Random Porn").build())
.queue();
} catch (IOException e) {
e.printStackTrace();
}
e.getTextChannel()
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Random Porn")
.build()).queue();
} else {
event.getTextChannel()
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
e.getTextChannel()
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
.queue();
}
}

View file

@ -1,48 +1,42 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class SoloCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/girls_solo/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/girls_solo/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Solo")
.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
}
}

View file

@ -1,48 +1,43 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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.JSONObject;
import java.io.IOException;
import com.bbn.hadder.utils.Request;
public class SpankCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/spank/").build();
String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/spank/");
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
url.replace("\"}", ""))
.setImage(url.replace("\"}", "")).setFooter("Spank").build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Spank")
.build()).queue();
} else {
event.getTextChannel()
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
e.getTextChannel()
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
.queue();
}
}

View file

@ -1,44 +1,43 @@
package com.bbn.hadder.commands.nsfw;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.nsfw;
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 java.io.IOException;
import com.bbn.hadder.utils.Request;
public class TransCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (event.getTextChannel().isNSFW()) {
public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient();
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/trap").build();
String url = Request.get("https://nekos.life/api/v2/img/trap/");
try {
Response response = caller.newCall(request).execute();
String url = response.body().string().replace("{\"url\":\"", "");
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
url.replace("\"}", ""))
.setImage(url.replace("\"}", "")).setFooter("Trans").build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
.setImage(url)
.setFooter("Trans")
.build()).queue();
} else {
event.getTextChannel()
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
e.getTextChannel()
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
.queue();
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.owner;
/*
* @author Hax / Hax6775 / Schlauer_Hax
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.owner;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -21,9 +33,9 @@ import java.util.List;
public class BlacklistCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length == 0) {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
} else {
switch (args[0].toLowerCase()) {
case "add":
@ -78,15 +90,15 @@ public class BlacklistCommand implements Command {
}
}
}
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setTitle("Blacklisted Users:")
.setDescription((stringBuilder.length()!=0) ? ("``" + stringBuilder.toString() + "``") : "No blacklisted Users")
.build()).queue();
break;
default:
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
break;
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.owner;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.owner;
import com.bbn.hadder.Hadder;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
@ -22,7 +34,7 @@ import java.util.concurrent.TimeUnit;
public class EvalCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
@ -32,18 +44,18 @@ public class EvalCommand implements Command {
ex.printStackTrace();
}
engine.put("msg".toLowerCase(), event.getMessage());
engine.put("msg".toLowerCase(), e.getMessage());
engine.put("shardmanager".toLowerCase(), Hadder.shardManager);
engine.put("rethink".toLowerCase(), event.getRethink());
engine.put("event".toLowerCase(), event);
engine.put("jda".toLowerCase(), event.getJDA());
engine.put("message".toLowerCase(), event.getMessage());
engine.put("guild".toLowerCase(), event.getGuild());
engine.put("channel".toLowerCase(), event.getChannel());
engine.put("author".toLowerCase(), event.getAuthor());
engine.put("member".toLowerCase(), event.getMember());
engine.put("self".toLowerCase(), event.getGuild().getSelfMember());
engine.put("audio".toLowerCase(), event.getAudioManager());
engine.put("rethink".toLowerCase(), e.getRethink());
engine.put("e".toLowerCase(), e);
engine.put("jda".toLowerCase(), e.getJDA());
engine.put("message".toLowerCase(), e.getMessage());
engine.put("guild".toLowerCase(), e.getGuild());
engine.put("channel".toLowerCase(), e.getChannel());
engine.put("author".toLowerCase(), e.getAuthor());
engine.put("member".toLowerCase(), e.getMember());
engine.put("self".toLowerCase(), e.getGuild().getSelfMember());
engine.put("audio".toLowerCase(), e.getAudioManager());
engine.put("out".toLowerCase(), System.out);
ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
@ -61,21 +73,21 @@ public class EvalCommand implements Command {
}
out = engine.eval(script.toString());
event.getTextChannel().sendMessage(event.getMessageEditor()
e.getTextChannel().sendMessage(e.getMessageEditor()
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.input"),
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.input"),
"```java\n\n" + script + "```", false)
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.output"),
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.output"),
"```java\n\n" + out.toString() + "```", false)
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
System.currentTimeMillis() - startExec + " milliseconds", false)
.build()).queue();
} catch (Exception ex) {
event.getTextChannel().sendMessage(event.getMessageEditor()
e.getTextChannel().sendMessage(e.getMessageEditor()
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
.addField(event.getMessageEditor().getTerm("error"),
.addField(e.getMessageEditor().getTerm("error"),
"```java\n\n" + ex.getMessage() + "```", false)
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
System.currentTimeMillis() - startExec + " milliseconds", false)
.build()).queue();
@ -86,7 +98,7 @@ public class EvalCommand implements Command {
}, 0, TimeUnit.MILLISECONDS);
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.owner;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.owner;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -15,22 +27,22 @@ import net.dv8tion.jda.api.entities.Guild;
public class GuildLeaveCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
Guild guild = event.getJDA().getGuildById(args[0]);
Guild guild = e.getJDA().getGuildById(args[0]);
try {
guild.leave().queue();
event.getTextChannel()
.sendMessage(event.getMessageEditor()
e.getTextChannel()
.sendMessage(e.getMessageEditor()
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.guildleave.success.title",
"", "commands.owner.guildleave.success.description", guild.getName())
.build())
.queue();
} catch (Exception e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.owner.guildleave.error.title", "", "commands.owner.guildleave.help.description", guild.getName()).build()).queue();
} catch (Exception ex) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.owner.guildleave.error.title", "", "commands.owner.guildleave.help.description", guild.getName()).build()).queue();
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.owner;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.owner;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -13,7 +25,7 @@ import com.bbn.hadder.core.Perms;
public class RebootCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
Runtime.getRuntime().exit(69);
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.owner;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.owner;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
@ -14,9 +26,9 @@ import com.bbn.hadder.utils.MessageEditor;
public class ShutdownCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO).setTitle("Shutdown").build()).queue();
event.getJDA().getShardManager().shutdown();
public void executed(String[] args, CommandEvent e) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO).setTitle("Shutdown").build()).queue();
e.getJDA().getShardManager().shutdown();
System.out.println("Bot shut down via Command...");
Runtime.getRuntime().exit(69);
}

View file

@ -1,18 +1,30 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.owner;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor.MessageType;
/*
* @author Skidder / GregTCLTK
*/
public class TestCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageType.INFO, "commands.owner.test.success", "").build()).queue();
public void executed(String[] args, CommandEvent e) {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageType.INFO, "commands.owner.test.success", "").build()).queue();
}
@Override

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.commands.settings;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.settings;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -11,33 +23,33 @@ import com.bbn.hadder.utils.MessageEditor;
public class LanguageCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length == 1) {
switch (args[0].toLowerCase()) {
case "de":
setLanguage("de", "German", event);
setLanguage("de", "German", e);
break;
case "en":
setLanguage("en", "English", event);
setLanguage("en", "English", e);
break;
case "es":
setLanguage("es", "Spanish", event);
setLanguage("es", "Spanish", e);
break;
case "fr":
setLanguage("fr", "French", event);
setLanguage("fr", "French", e);
break;
case "ru":
setLanguage("ru", "Russian", event);
setLanguage("ru", "Russian", e);
break;
case "tr":
setLanguage("tr", "Turkish", event);
setLanguage("tr", "Turkish", e);
break;
case "zh":
setLanguage("zh", "Chinese", event);
setLanguage("zh", "Chinese", e);
break;
}
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}
@ -45,7 +57,7 @@ public class LanguageCommand implements Command {
event.getRethinkUser().setLanguage(language_code);
event.getTextChannel()
.sendMessage(
event.getMessageEditor()
e.getMessageEditor()
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.language.success.title",
"", "commands.settings.language.success.description", language)
.build())

View file

@ -1,16 +1,28 @@
package com.bbn.hadder.commands.settings;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.settings;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
public class UserPrefixCommand implements Command {
public void executed(String[] args, CommandEvent event) {
public void executed(String[] args, CommandEvent e) {
if (args.length == 1) {
event.getRethinkUser().setPrefix(args[0]);
event.getTextChannel()
@ -21,7 +33,7 @@ public class UserPrefixCommand implements Command {
.queue();
event.getRethinkUser().push();
} else {
event.getHelpCommand().sendHelp(this, event);
e.getHelpCommand().sendHelp(this, e);
}
}

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.core;
import com.bbn.hadder.Rethink;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.core;
import org.json.JSONObject;

View file

@ -1,13 +1,24 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.core;
import com.bbn.hadder.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
/**
* @author Skidder / GregTCLTK
* @author Hax / Hax6775 / Schlauer_Hax
*/
public enum Perm {
BOT_OWNER() {

View file

@ -1,13 +1,24 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.core;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author Skidder / GregTCLTK
* @author Hax / Hax6775 / Schlauer_Hax
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Perms {
Perm[] value() default {};

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
@ -10,10 +26,6 @@ import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.json.JSONObject;
/*
* @author Skidder / GregTCLTK
*/
public class CommandListener extends ListenerAdapter {
private Rethink rethink;

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.listener;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
import com.bbn.hadder.core.Config;
import com.bbn.hadder.utils.BotList;
@ -26,48 +38,48 @@ public class GuildListener extends ListenerAdapter {
this.config = config;
}
public void onGuildJoin(GuildJoinEvent event) {
public void onGuildJoin(GuildJoinEvent e) {
new Thread(() -> {
for (Member member : event.getGuild().getMembers()) {
if (!member.getUser().getId().equals(event.getJDA().getSelfUser().getId())) {
for (Member member : e.getGuild().getMembers()) {
if (!member.getUser().getId().equals(e.getJDA().getSelfUser().getId())) {
rethink.insertUser(member.getUser().getId());
}
}
}).start();
rethink.insertGuild(event.getGuild().getId());
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
rethink.insertGuild(e.getGuild().getId());
e.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
.setTitle("Joined Server")
.setThumbnail(event.getGuild().getIconUrl())
.addField("Name", event.getGuild().getName(), true)
.addField("Guild ID", event.getGuild().getId(), true)
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
.addField("Users", String.valueOf(event.getGuild().getMembers().size()), true)
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
.setThumbnail(e.getGuild().getIconUrl())
.addField("Name", e.getGuild().getName(), true)
.addField("Guild ID", e.getGuild().getId(), true)
.addField("Guild Owner", e.getGuild().getOwner().getUser().getAsTag(), true)
.addField("Users", String.valueOf(e.getGuild().getMembers().size()), true)
.setFooter(e.getJDA().getSelfUser().getName(), e.getJDA().getSelfUser().getAvatarUrl())
.setTimestamp(Instant.now())
.build()).queue();
new BotList(config).post();
}
public void onGuildLeave(GuildLeaveEvent event) {
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
public void onGuildLeave(GuildLeaveEvent e) {
e.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
.setTitle("Left Server")
.setThumbnail(event.getGuild().getIconUrl())
.addField("Name", event.getGuild().getName(), true)
.addField("Guild ID", event.getGuild().getId(), true)
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
.addField("Users", String.valueOf(event.getGuild().getMembers().size()), true)
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
.setThumbnail(e.getGuild().getIconUrl())
.addField("Name", e.getGuild().getName(), true)
.addField("Guild ID", e.getGuild().getId(), true)
.addField("Guild Owner", e.getGuild().getOwner().getUser().getAsTag(), true)
.addField("Users", String.valueOf(e.getGuild().getMembers().size()), true)
.setFooter(e.getJDA().getSelfUser().getName(), e.getJDA().getSelfUser().getAvatarUrl())
.setTimestamp(Instant.now())
.build()).queue();
new BotList(config).post();
}
public void onGuildMemberJoin(GuildMemberJoinEvent event) {
if (!event.getUser().getId().equals(event.getJDA().getSelfUser().getId())) {
rethink.insertUser(event.getUser().getId());
public void onGuildMemberJoin(GuildMemberJoinEvent e) {
if (!e.getUser().getId().equals(e.getJDA().getSelfUser().getId())) {
rethink.insertUser(e.getUser().getId());
}
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.listener;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
import com.bbn.hadder.RethinkServer;
import net.dv8tion.jda.api.Permission;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.listener;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
import com.bbn.hadder.RethinkUser;
import com.bbn.hadder.utils.MessageEditor;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
@ -21,15 +37,15 @@ public class ReadyListener extends ListenerAdapter {
}
@Override
public void onReady(@Nonnull ReadyEvent event) {
public void onReady(@Nonnull ReadyEvent e) {
rethink.setup();
new Thread(() -> {
for (User user : event.getJDA().getUsers()) {
if (!user.getId().equals(event.getJDA().getSelfUser().getId())) {
for (User user : e.getJDA().getUsers()) {
if (!user.getId().equals(e.getJDA().getSelfUser().getId())) {
rethink.insertUser(user.getId());
}
}
for (Guild g : event.getJDA().getGuilds()) {
for (Guild g : e.getJDA().getGuilds()) {
rethink.insertGuild(g.getId());
}
}).start();

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.listener;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
import com.bbn.hadder.RethinkServer;
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
@ -21,13 +37,13 @@ public class StarboardListener extends ListenerAdapter {
}
@Override
public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent event) {
update(event);
public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent e) {
update(e);
}
@Override
public void onMessageReactionRemove(@Nonnull MessageReactionRemoveEvent event) {
update(event);
public void onMessageReactionRemove(@Nonnull MessageReactionRemoveEvent e) {
update(e);
}
public void update(GenericMessageReactionEvent event) {
@ -47,14 +63,14 @@ public class StarboardListener extends ListenerAdapter {
if (Integer.parseInt(rethinkServer.getNeededstars()) <= stars) {
event.getGuild().getTextChannelById(rethinkServer.getStarboard())
.sendMessage(new MessageBuilder()
.setContent("⭐ 1" + " " + event.getTextChannel().getAsMention())
.setContent("⭐ 1" + " " + e.getTextChannel().getAsMention())
.setEmbed(
new EmbedBuilder()
.setAuthor(msg.getAuthor().getAsTag())
.setDescription(msg.getContentRaw())
.setTimestamp(msg.getTimeCreated()).build()).build()).queue(
starboardmsg -> {
rethink.insertStarboardMessage(msg.getId(), event.getGuild().getId(), starboardmsg.getId());
rethink.insertStarboardMessage(msg.getId(), e.getGuild().getId(), starboardmsg.getId());
}
);
}
@ -64,7 +80,7 @@ public class StarboardListener extends ListenerAdapter {
}
} else {
event.getTextChannel().retrieveMessageById(event.getMessageId()).queue(
e.getTextChannel().retrieveMessageById(e.getMessageId()).queue(
msg -> {
Integer stars = 0;
for (MessageReaction reaction : msg.getReactions()) {
@ -80,7 +96,7 @@ public class StarboardListener extends ListenerAdapter {
if (Integer.parseInt(rethinkServer.getNeededstars()) <= finalStars) {
msg2.editMessage(new MessageBuilder()
.setContent("" + finalStars + " " + event.getTextChannel().getAsMention())
.setContent("" + finalStars + " " + e.getTextChannel().getAsMention())
.setEmbed(
new EmbedBuilder()
.setAuthor(msg.getAuthor().getAsTag())

View file

@ -1,13 +1,25 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.listener;
import com.bbn.hadder.audio.AudioManager;
import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
/**
* @author Skidder / GregTCLTK
*/
public class VoiceLeaveListener extends ListenerAdapter {
private AudioManager audioManager;
@ -17,12 +29,12 @@ public class VoiceLeaveListener extends ListenerAdapter {
}
@Override
public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) {
if (audioManager.hasPlayer(event.getGuild()) && event.getChannelLeft().getMembers().equals(event.getGuild().getSelfMember())) {
audioManager.players.remove(event.getGuild().getId());
audioManager.getPlayer(event.getGuild()).destroy();
audioManager.getTrackManager(event.getGuild()).purgeQueue();
event.getGuild().getAudioManager().closeAudioConnection();
public void onGuildVoiceLeave(GuildVoiceLeaveEvent e) {
if (audioManager.hasPlayer(e.getGuild()) && e.getChannelLeft().getMembers().equals(e.getGuild().getSelfMember())) {
audioManager.players.remove(e.getGuild().getId());
audioManager.getPlayer(e.getGuild()).destroy();
audioManager.getTrackManager(e.getGuild()).purgeQueue();
e.getGuild().getAudioManager().closeAudioConnection();
}
}
}

View file

@ -1,9 +1,21 @@
package com.bbn.hadder.utils;
/*
* @author Skidder / GregTCLTK
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.utils;
import com.bbn.hadder.Hadder;
import com.bbn.hadder.core.Config;
import okhttp3.MediaType;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.utils;
import net.dv8tion.jda.api.JDA;

View file

@ -1,3 +1,19 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.utils;
import com.bbn.hadder.Rethink;

View file

@ -0,0 +1,48 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.utils;
import okhttp3.OkHttpClient;
import okhttp3.Response;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
public class Request {
public static String get(String url) {
OkHttpClient caller = new OkHttpClient();
okhttp3.Request request = new okhttp3.Request.Builder().url(url).build();
try {
Response response = caller.newCall(request).execute();
JSONObject json = new JSONObject(response.body().string());
try {
JSONObject data = json.getJSONObject("data");
JSONObject response1 = data.getJSONObject("response");
return response1.toString().replace("{\"url\":\"", "").replace("\"}", "");
} catch (Exception ignore) {
return json.getString("url");
}
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
}
}

View file

@ -9,6 +9,8 @@ none = None
success\! = Success\!
commands.fun.avatar.success.title = Avatar of %extra%
commands.fun.avatar.error.title = User not found
commands.fun.avatar.error.description = I can not find a user with this id!
commands.fun.avatar.help.description = Sends the avatar of the specified member.
commands.fun.gif.error.description = Please try again with another term.
commands.fun.gif.help.description = Looks for a GIF on Giphy.