v1.0.1 #355
33 changed files with 305 additions and 68 deletions
|
|
@ -26,7 +26,7 @@ Hax#6775
|
|||
| h.help | Shows each command and explains its usage. |
|
||||
| h.about | Shows information about Hadder. |
|
||||
| h.equals | Checks if two strings are the same. |
|
||||
| h.invite | Shows the invite link to invite Hadder to your server. |
|
||||
| h.invite | Shows the invite link to invite Hadder to your server. |
|
||||
| h.ping | Shows the ping to the Discord API. |
|
||||
| h.avatar | Sends the avatar of the specified member. |
|
||||
| h.gif | Looks for a GIF on Giphy. |
|
||||
|
|
|
|||
39
pom.xml
39
pom.xml
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Hadder</groupId>
|
||||
<artifactId>Hadder</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
|
||||
<name>Hadder</name>
|
||||
|
||||
|
|
@ -13,8 +13,32 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.13</maven.compiler.source>
|
||||
<maven.compiler.target>1.13</maven.compiler.target>
|
||||
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>Hax#6775</id>
|
||||
<name>Hax</name>
|
||||
<email>hax@bigbotnetwork.com</email>
|
||||
<url>https://bigbotnetwork.com/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/261083609148948488/f2c9efc629ef65fffa634f0d63cd467e.webp</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>Skidder#6775</id>
|
||||
<name>Greg</name>
|
||||
<email>skidder@bigbotnetwork.com</email>
|
||||
<url>https://bigbotnetwork.com/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/477141528981012511/a_ba4bd8e5b381874edcd06a68d1acd3aa.gif</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
|
|
@ -24,10 +48,15 @@
|
|||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.1.1_101</version>
|
||||
<version>4.1.1_105</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
|
|
@ -52,12 +81,12 @@
|
|||
<dependency>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.103</version>
|
||||
<version>1.106</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
<artifactId>lavaplayer</artifactId>
|
||||
<version>1.3.33</version>
|
||||
<version>1.3.34</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import net.dv8tion.jda.api.OnlineStatus;
|
|||
import net.dv8tion.jda.api.entities.Activity;
|
||||
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
|
||||
import net.dv8tion.jda.api.sharding.ShardManager;
|
||||
import net.dv8tion.jda.api.utils.ChunkingFilter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -54,7 +55,9 @@ public class Hadder {
|
|||
|
||||
builder.setAutoReconnect(true);
|
||||
builder.setShardsTotal(1);
|
||||
builder.setActivity(Activity.streaming("on the BigBotNetwork", "https://twitch.tv/BigBotNetwork"));
|
||||
builder.setChunkingFilter(ChunkingFilter.ALL);
|
||||
builder.setBulkDeleteSplittingEnabled(true);
|
||||
builder.setActivity(Activity.listening("to h.help"));
|
||||
builder.setStatus(OnlineStatus.DO_NOT_DISTURB);
|
||||
builder.setToken(config.getBotToken());
|
||||
|
||||
|
|
@ -120,7 +123,9 @@ public class Hadder {
|
|||
new PauseCommand(),
|
||||
new LoopCommand(),
|
||||
new BassCommand(),
|
||||
new EchoCommand()), config, helpCommand);
|
||||
new EchoCommand(),
|
||||
new ServerStatsCommand(),
|
||||
new ProfileCommand()), config, helpCommand);
|
||||
|
||||
builder.addEventListeners(
|
||||
new MentionListener(rethink),
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ public class Rethink {
|
|||
}
|
||||
}
|
||||
}
|
||||
r.table("server").get(server.getId()).update(object).run(conn);
|
||||
r.table("server").get(server.getId()).update(object.toMap()).run(conn);
|
||||
}
|
||||
|
||||
public void pushUser(RethinkUser user) {
|
||||
|
|
@ -188,7 +188,7 @@ public class Rethink {
|
|||
}
|
||||
}
|
||||
}
|
||||
r.table("user").get(user.getId()).update(object).run(conn);
|
||||
r.table("user").get(user.getId()).update(object.toMap()).run(conn);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,18 +43,10 @@ public class RethinkUser {
|
|||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
public RethinkUser(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Rethink getRethink() {
|
||||
return rethink;
|
||||
}
|
||||
|
||||
public void setRethink(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,16 +18,12 @@ package com.bbn.hadder.audio;
|
|||
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
||||
import com.sedmelluq.discord.lavaplayer.player.*;
|
||||
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
|
||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class AvatarCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[User]";
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class ClydeCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Content]";
|
||||
return "[content]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -70,11 +70,11 @@ public class GifCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Term]";
|
||||
return "[term]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Cute cat";
|
||||
return "cute cat";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public class HelpCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Command name]";
|
||||
return "[command]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class GitHubCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[GH name]";
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* 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;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class ProfileCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
User u = null;
|
||||
if (args.length == 0) {
|
||||
u = e.getAuthor();
|
||||
} else if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
|
||||
u = e.getJDA().getUserById(args[0]);
|
||||
} else if (!StringUtils.isNumeric(args[0]) && args[0].contains("#")) {
|
||||
try {
|
||||
u = e.getJDA().getUserByTag(args[0]);
|
||||
} catch (Exception ex) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.profile.error.title",
|
||||
"commands.misc.profile.error.description").build()).queue();
|
||||
return;
|
||||
}
|
||||
} else if (e.getMessage().getMentionedUsers().size() == 1) {
|
||||
u = e.getMessage().getMentionedUsers().get(0);
|
||||
}
|
||||
try {
|
||||
// TODO: Translate
|
||||
EmbedBuilder embed = e.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("User Information")
|
||||
.addField("Username", u.getName(), true)
|
||||
.addField("Tag", u.getAsTag(), true)
|
||||
.addField("ID", u.getId(), true)
|
||||
.addField("Account Creation Date", u.getTimeCreated()
|
||||
.format(DateTimeFormatter.ISO_DATE_TIME).replace("T", " ").replace("Z", ""), true)
|
||||
.addField("Nickname", e.getGuild().getMember(u).getEffectiveName(), true)
|
||||
.addField("Guild Join Date", e.getGuild().getMember(u).getTimeJoined()
|
||||
.format(DateTimeFormatter.ISO_DATE_TIME).replace("T", " ").replace("Z", ""), true)
|
||||
.addField("Roles", String.valueOf(e.getGuild().getMember(u).getRoles().size()), true);
|
||||
|
||||
e.getChannel().sendMessage(embed.build()).queue();
|
||||
} catch (NullPointerException ex) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.profile.error.title",
|
||||
"commands.misc.profile.error.description").build()).queue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"profile", "user", "userinfo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.profile.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[user/id]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Hax#6775";
|
||||
}
|
||||
}
|
||||
|
|
@ -91,11 +91,11 @@ public class ScreenShareCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Channel]";
|
||||
return "[channel]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Gaming-Lounge";
|
||||
return "Talk";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ServerStatsCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
EmbedBuilder eb = e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.misc.serverstats.title", "",
|
||||
"commands.misc.serverstats.description", e.getGuild().getName())
|
||||
.addField("Owner", e.getGuild().getOwner().getUser().getAsTag(), true)
|
||||
.addField("ID", e.getGuild().getId(), true)
|
||||
.addField("Region", e.getGuild().getRegion().getName(), true)
|
||||
.addField("Time created", new Date(e.getGuild().getTimeCreated().toInstant().toEpochMilli()).toString(), true)
|
||||
.addField("Roles", String.valueOf(e.getGuild().getRoles().size()), true)
|
||||
.addField("Emotes", String.valueOf(e.getGuild().getEmotes().size()), true)
|
||||
.addField("Categories", String.valueOf(e.getGuild().getCategories().size()), true)
|
||||
.addField("Text/Voice/Store Channels", "`" + e.getGuild().getTextChannels().size() + "`" + "/" + "`" + e.getGuild().getVoiceChannels().size() + "`" + "/" + "`" + e.getGuild().getStoreChannels().size() + "`", true)
|
||||
.addField("Verification Level", e.getGuild().getVerificationLevel().getKey() + ": " + e.getGuild().getVerificationLevel(), true)
|
||||
.addField("MFA Level", String.valueOf(e.getGuild().getRequiredMFALevel().getKey()), true)
|
||||
.addField("Member Count", String.valueOf(e.getGuild().getMemberCount()), true)
|
||||
.addField("Explicit Content Level", e.getGuild().getExplicitContentLevel().getKey() + ": " + e.getGuild().getExplicitContentLevel(), true)
|
||||
//TODO: Features
|
||||
.setThumbnail(e.getGuild().getIconUrl())
|
||||
.setImage(e.getGuild().getBannerUrl());
|
||||
|
||||
if (e.getGuild().getDescription() != null) eb.addField("Description", e.getGuild().getDescription(), true);
|
||||
if (e.getGuild().getVanityCode() != null) eb.addField("Vanity Code", "[" + e.getGuild().getVanityCode() + "](https://discord.gg/" + e.getGuild().getVanityCode() + ")", true);
|
||||
|
||||
e.getTextChannel().sendMessage(eb.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"serverstats", "guildstats"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.serverstats.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ public class BanCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[User(s)]";
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class ClearCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Amount]";
|
||||
return "[amount]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class KickCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[User(s)]";
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class NickCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[User(s)] [New nickname]";
|
||||
return "[user] [nickname]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class PrefixCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[New Prefix]";
|
||||
return "[new prefix]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class RegionChangeCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[New region]";
|
||||
return "[new region]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class RoleCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[add/remove] [Role>] [User]";
|
||||
return "[add/remove] [role] [user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class StarboardCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Channel] [Needed stars]";
|
||||
return "[channel] [needed stars]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class BassCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Bass-Level]";
|
||||
return "[bass level]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class PlayCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Song URL/Name]";
|
||||
return "[URL/name]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.bbn.hadder.commands.music;
|
|||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import org.jsoup.internal.StringUtil;
|
||||
|
||||
public class VolumeCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ public class VolumeCommand implements Command {
|
|||
if (args.length > 0) {
|
||||
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 {
|
||||
if (StringUtil.isNumeric(args[0])) {
|
||||
int volume = Integer.parseInt(args[0]);
|
||||
if (volume < 201 && volume > 0 || e.getConfig().getOwners().contains(e.getAuthor().getIdLong())) {
|
||||
e.getAudioManager().getPlayer(e.getGuild()).setVolume(volume);
|
||||
|
|
@ -39,9 +40,7 @@ public class VolumeCommand implements Command {
|
|||
"commands.music.volume.error.int.title",
|
||||
"commands.music.volume.error.int.description").build()).queue();
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.volume.error.connected.title",
|
||||
|
|
@ -68,7 +67,7 @@ public class VolumeCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[New volume]";
|
||||
return "[volume]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.bbn.hadder.commands.CommandEvent;
|
|||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -50,9 +49,9 @@ public class BlacklistCommand implements Command {
|
|||
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
||||
e.getRethinkUser().setBlacklisted(newblacklisted);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Removed Blacklisted Commands from User")
|
||||
.setDescription("Blacklisted commands: "+newblacklisted)
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.owner.blacklist.success.add.title", "",
|
||||
"commands.owner.blacklist.success.add.description", newblacklisted)
|
||||
.build()).queue();
|
||||
e.getRethinkUser().push();
|
||||
}
|
||||
|
|
@ -70,9 +69,9 @@ public class BlacklistCommand implements Command {
|
|||
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
||||
e.getRethinkUser().setBlacklisted(newblacklisted);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Removed Blacklisted Commands from User")
|
||||
.setDescription("Blacklisted commands: "+newblacklisted)
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.owner.blacklist.success.remove.title", "",
|
||||
"commands.owner.blacklist.success.remove.description", newblacklisted)
|
||||
.build()).queue();
|
||||
e.getRethinkUser().push();
|
||||
}
|
||||
|
|
@ -114,7 +113,7 @@ public class BlacklistCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "add|remove|list command @User";
|
||||
return "[add|remove|list] [command] [user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class EvalCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Code]";
|
||||
return "[code]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class GuildLeaveCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Guild-ID]";
|
||||
return "[id]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package com.bbn.hadder.commands.settings;
|
|||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
|
||||
public class LanguageCommand implements Command {
|
||||
|
||||
|
|
@ -83,7 +82,7 @@ public class LanguageCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Language code]";
|
||||
return "[language code]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class UserPrefixCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[New Prefix]";
|
||||
return "[new prefix]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,12 +19,17 @@ package com.bbn.hadder.listener;
|
|||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import com.bbn.hadder.RethinkUser;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
public class MentionListener extends ListenerAdapter {
|
||||
|
|
@ -42,14 +47,34 @@ public class MentionListener extends ListenerAdapter {
|
|||
RethinkUser rethinkUser = new RethinkUser(rethink.getObjectByID("user", e.getAuthor().getId()), rethink);
|
||||
if (e.isFromType(ChannelType.TEXT) && (e.getMessage().getContentRaw().equals(e.getGuild().getSelfMember().getAsMention()) ||
|
||||
e.getMessage().getContentRaw().equals(e.getGuild().getSelfMember().getAsMention().replace("@", "@!")))) {
|
||||
e.getChannel().sendMessage(new MessageEditor(rethinkUser, e.getAuthor()).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Hello I'm Hadder.")
|
||||
.setAuthor(e.getJDA().getSelfUser().getName(), e.getJDA().getSelfUser().getAvatarUrl(), e.getJDA().getSelfUser().getAvatarUrl())
|
||||
.addField("Users", String.valueOf(e.getJDA().getUsers().size()), false)
|
||||
.addField("Guilds", String.valueOf(e.getJDA().getGuilds().size()), false)
|
||||
.addField("Prefix (User)", rethinkUser.getPrefix(), false)
|
||||
.addField("Prefix (Guild)", rethinkServer.getPrefix(), false)
|
||||
.build()).queue();
|
||||
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
Model model = null;
|
||||
try {
|
||||
model = reader.read(new FileReader("pom.xml"));
|
||||
} catch (IOException | XmlPullParserException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
EmbedBuilder builder = new EmbedBuilder()
|
||||
.setTitle("Hi!")
|
||||
.addField("Version", model.getVersion(), false)
|
||||
.addField("User-Prefix", rethinkUser.getPrefix(), true)
|
||||
.addField("Guild-Prefix", rethinkServer.getPrefix(), true);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
model.getDependencies().forEach(
|
||||
dependency -> stringBuilder.append(dependency.getArtifactId()).append(" - ").append(dependency.getVersion()).append("\n")
|
||||
);
|
||||
builder.addField("Dependencies", stringBuilder.toString(), false);
|
||||
StringBuilder devs = new StringBuilder();
|
||||
//TODO: Fix Mail stuff
|
||||
model.getDevelopers().forEach(
|
||||
developer -> devs.append(developer.getId()).append(" - [Website](").append(developer.getUrl()).append("), [E-Mail](https://hax.bigbotnetwork.de/redirect.html?url=mailto:").append(developer.getEmail()).append(")\n")
|
||||
);
|
||||
builder.addField("Developer", devs.toString(), false);
|
||||
builder.addField("Join our Dev Server!", "[Click here!](https://discord.gg/58My2dM)", true);
|
||||
builder.addField("Github", "[Click here!](https://github.com/BigBotNetwork/Hadder)",false);
|
||||
builder.addField("Twitch", "[Click here!](https://www.twitch.tv/bigbotnetwork)", false);
|
||||
e.getChannel().sendMessage(builder.build()).queue();
|
||||
} else if (e.getMessage().getContentRaw().equalsIgnoreCase("@someone")) {
|
||||
int member = new Random().nextInt(e.getGuild().getMembers().size() - 1);
|
||||
if (member > 0 && member < e.getGuild().getMembers().size()) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.bbn.hadder.utils;
|
|||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.react.GuildMessageReactionAddEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
|
@ -42,4 +43,20 @@ public class EventWaiter {
|
|||
jda.getShardManager().addEventListener(listener);
|
||||
}
|
||||
|
||||
public void newOnReactionEventWaiter(Consumer<GuildMessageReactionAddEvent> onEvent, JDA jda, User user) {
|
||||
Object listener = new ListenerAdapter() {
|
||||
@Override
|
||||
public void onGuildMessageReactionAdd(@Nonnull GuildMessageReactionAddEvent event) {
|
||||
if (user==null) {
|
||||
onEvent.accept(event);
|
||||
event.getJDA().getShardManager().removeEventListener(this);
|
||||
} else if (event.getUser().getId().equals(user.getId())) {
|
||||
onEvent.accept(event);
|
||||
event.getJDA().getShardManager().removeEventListener(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
jda.getShardManager().addEventListener(listener);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,12 @@ commands.misc.screenshare.number.error.description = This isn't a Number.
|
|||
commands.misc.screenshare.channel.existing.error = Hol' up
|
||||
commands.misc.screenshare.channel.existing.description = There is no Voice Channel named like this. \n\nNote\: Make sure the Voice Channel is in this Guild.
|
||||
commands.misc.screenshare.help.description = Shows you the link to share your screen.
|
||||
commands.misc.serverstats.title = Serverstats
|
||||
commands.misc.serverstats.description = This message contains some information about `%extra%`
|
||||
commands.misc.serverstats.help.description = Shows information about a server.
|
||||
commands.misc.profile.error.title = Not found
|
||||
commands.misc.profile.error.description = I can't find the specified user.
|
||||
commands.misc.profile.help.description = Shows some information about the specified user.
|
||||
|
||||
commands.moderation.ban.success.title = Successfully banned
|
||||
commands.moderation.ban.success.description = I successfully baned %extra%
|
||||
|
|
@ -299,6 +305,10 @@ commands.owner.shutdown.success.title = Shutdown
|
|||
commands.owner.shutdown.help.description = Shuts the Bot down
|
||||
commands.owner.test.success = TEST my friends
|
||||
commands.owner.test.help.description = Just a little Test Command
|
||||
commands.owner.blacklist.success.add.title = Successfully blacklisted the specified commands
|
||||
commands.owner.blacklist.success.add.description = I successfully added the following commands from the blacklist:\n %extra%
|
||||
commands.owner.blacklist.success.remove.title = Successfully removed the commands from the blacklist
|
||||
commands.owner.blacklist.success.remove.description = I successfully removed the following commands from the blacklist:\n %extra%
|
||||
commands.owner.blacklist.help.description = Blacklist a user for specific commands
|
||||
|
||||
commands.settings.language.success.title = Language set
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue