Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #557 from BigBotNetwork/greg-dev
Browse files Browse the repository at this point in the history
1.3.19
  • Loading branch information
greg6775 authored Oct 15, 2020
2 parents d77a4ea + f50f1ea commit 02c4312
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 132 deletions.
113 changes: 61 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,61 @@
# Hadder

Hadder Discord is a multi-purpose Discord bot with 100% uptime.

<a href="https://discord.gg/nPwjaJk"><img src="https://discord.com/api/guilds/757966278936756345/embed.png"/></a>
[![Build Status](https://github.com/BigBotNetwork/Hadder/workflows/Hadder/badge.svg)](https://github.com/BigBotNetwork/Hadder)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ddb8cb7ec85f467caa691c175e1f01b5)](https://www.codacy.com/gh/BigBotNetwork/Hadder?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=BigBotNetwork/Hadder&amp;utm_campaign=Badge_Grade)
[![CodeFactor](https://www.codefactor.io/repository/github/bigbotnetwork/hadder/badge)](https://www.codefactor.io/repository/github/bigbotnetwork/hadder)
[![Crowdin](https://badges.crowdin.net/e/bc0babde730eb3eada34778502a31b03/localized.svg)](https://bbn.crowdin.com/hadder)
[![GitHub issues](https://img.shields.io/github/issues/BigBotNetwork/Hadder)](https://github.com/BigBotNetwork/Hadder/issues)
[![GitHub license](https://img.shields.io/github/license/BigBotNetwork/Hadder)](https://github.com/BigBotNetwork/Hadder/blob/master/LICENSE)
[![time tracker](https://wakatime.com/badge/github/BigBotNetwork/Hadder.svg)](https://wakatime.com/badge/github/BigBotNetwork/Hadder)

## Hadder Team
### Developer
Skidder#6775 <br>
Hax#6775

## A few commands
| **Command** | **Description** |
|----------------|---------------------------------------------------------------|
| 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.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. |
| h.meme | Sends you a random meme. |
| h.clyde | Sends a message as a webhook named Clyde. |
| h.feedback | Sends feedback directly to the developers. |
| h.github | Displays information about a GitHub user profile. |
| h.screenshare | Shows you the link to share your screen. |
| h.ban | Bans one or more users from the server. |
| h.clear | Deletes the specified number of messages. |
| h.prefix | Sets the Guild-Prefix. |
| h.invitedetect | Activate or deactivate the Discord invite link detection. |
| h.kick | Kicks one or more user from the server. |
| h.nick | Rename a one or more user. |
| h.regionchange | Changes the server region to locked regions. |
| h.role | Adds and removes one or more role(s) from one or more user(s) |
| h.rules | Setup the rules on your Discord server |
| h.starboard | Sets the starboard channel. |
| h.editrules | Edits the rules message. |
| h.join | Joins your voice channel. |
| h.leave | Leaves your voice channel. |
| h.play | Plays the specified song. |
| h.stop | Stops the song. |
| h.info | Shows information about the playing song. |
| h.queue | Shows the music queue. |
| h.skip | Skips the currently playing song. |
| h.volume | Change the volume of the music. |
# Hadder

Hadder Discord is a multi-purpose Discord bot with 100% uptime.

<a href="https://discord.gg/nPwjaJk"><img src="https://discord.com/api/guilds/757966278936756345/embed.png"/></a>
[![Build Status](https://github.com/BigBotNetwork/Hadder/workflows/Hadder/badge.svg)](https://github.com/BigBotNetwork/Hadder)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ddb8cb7ec85f467caa691c175e1f01b5)](https://www.codacy.com/gh/BigBotNetwork/Hadder?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=BigBotNetwork/Hadder&amp;utm_campaign=Badge_Grade)
[![CodeFactor](https://www.codefactor.io/repository/github/bigbotnetwork/hadder/badge)](https://www.codefactor.io/repository/github/bigbotnetwork/hadder)
[![Crowdin](https://badges.crowdin.net/e/bc0babde730eb3eada34778502a31b03/localized.svg)](https://bbn.crowdin.com/hadder)
[![GitHub issues](https://img.shields.io/github/issues/BigBotNetwork/Hadder)](https://github.com/BigBotNetwork/Hadder/issues)
[![GitHub license](https://img.shields.io/github/license/BigBotNetwork/Hadder)](https://github.com/BigBotNetwork/Hadder/blob/master/LICENSE)
[![time tracker](https://wakatime.com/badge/github/BigBotNetwork/Hadder.svg)](https://wakatime.com/badge/github/BigBotNetwork/Hadder)

## Hadder Team
### Developer
Skidder#6775 <br>
Hax#6775

## A few commands
| **Command** | **Description** |
|----------------|---------------------------------------------------------------|
| h.about | Shows information about Hadder |
| h.avatar | Sends the avatar of the specified Member |
| h.ban | Bans one or more users from the server |
| h.bass | Change the bass for the song which is played at the moment |
| h.clear | Deletes the specified number of messages |
| h.clyde | Sends a message as a webhook named Clyde |
| h.code | Shows information about a invite code |
| h.corona | Shows the newest stats of COVID-19 |
| h.echo | Sends your voice through Hadder |
| h.editrules | Edits the rules message |
| h.equals | Checks if two strings are equal |
| h.feedback | Sends feedback directly to the developers |
| h.gif | Looks for a GIF on Giphy |
| h.github | Displays information about a GitHub user profile |
| h.help | Shows each command and explains its usage |
| h.info | Shows information about the playing song |
| h.invite | Shows the invitation link to invite Hadder to your server |
| h.invitedetect | Activate or deactivate the Discord invite link detection |
| h.join | Joins your voice channel |
| h.kick | Kicks one or more user from the server |
| h.language | Sets the new primary language for a user |
| h.loop | Repeats a song/queue |
| h.meme | Sends you a random meme |
| h.moveall | Moves all users in the source channel to the target channel |
| h.nick | Rename a one or more user |
| h.pause | Pause the playing song |
| h.ping | Shows the ping to the Discord API |
| h.play | Plays the specified song |
| h.prefix | Sets the Guild-Prefix |
| h.profile | Shows some information about the specified user |
| h.queue | Shows the music queue |
| h.regionchange | Changes the server region to locked regions |
| h.role | Adds and removes one or more role(s) from one or more user(s) |
| h.rules | Setup the rules on your Discord server |
| h.screenshare | Shows you the link to share your screen |
| h.serverstats | Shows information about a server |
| h.skip | Skips the currently playing song |
| h.starboard | Sets the starboard channel |
| h.stop | Stops the song |
| h.volume | Change the volume of the music |
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Hadder</groupId>
<artifactId>Hadder</artifactId>
<version>1.3.18</version>
<version>1.3.19</version>
<name>Hadder</name>
<inceptionYear>2019</inceptionYear>
<description>Hadder is a multi-purpose Discord bot.</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bbn/hadder/Hadder.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private static void startBot() {
new CoronaCommand()), config, helpCommand);

builder.addEventListeners(
new MentionListener(rethink),
new MentionListener(rethink, config),
new PrivateMessageListener(rethink),
new CommandListener(rethink, commandHandler, audioManager),
new GuildListener(rethink, config),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void executed(String[] args, CommandEvent e) {

@Override
public String[] labels() {
return new String[]{"invitedetect", "detectinvite"};
return new String[]{"invitedetect", "detectinvite", "invite-detect"};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void executed(String[] args, CommandEvent e) {
String blacklisted = e.getRethinkUser().getBlacklisted();
List<String> commands = new ArrayList<>();
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
if (args[0].toLowerCase().equals("add")) commands.addAll(Arrays.asList(args[1].split(",")));
if (args[0].equalsIgnoreCase("add")) commands.addAll(Arrays.asList(args[1].split(",")));
else commands.removeAll(Arrays.asList(args[1].split(",")));
LinkedHashSet<String> hashSet = new LinkedHashSet<>(commands);

Expand Down
44 changes: 19 additions & 25 deletions src/main/java/com/bbn/hadder/listener/MentionListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

package com.bbn.hadder.listener;

import com.bbn.hadder.core.Config;
import com.bbn.hadder.db.Rethink;
import com.bbn.hadder.db.RethinkServer;
import com.bbn.hadder.db.RethinkUser;
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 org.kohsuke.github.GHRepository;
import org.kohsuke.github.GitHub;

import javax.annotation.Nonnull;
import java.io.IOException;
Expand All @@ -34,9 +34,11 @@
public class MentionListener extends ListenerAdapter {

private Rethink rethink;
private Config config;

public MentionListener(Rethink rethink) {
public MentionListener(Rethink rethink, Config config) {
this.rethink = rethink;
this.config = config;
}

@Override
Expand All @@ -47,32 +49,24 @@ public void onMessageReceived(@Nonnull MessageReceivedEvent e) {
if (e.isFromType(ChannelType.TEXT) && (e.getMessage().getContentRaw().equals(e.getGuild().getSelfMember().getAsMention()) ||
e.getMessage().getContentRaw().equals(e.getGuild().getSelfMember().getAsMention().replace("@", "@!")))) {

MavenXpp3Reader reader = new MavenXpp3Reader();
Model model = null;
String version = null;

try {
model = reader.read(getClass().getResourceAsStream("pom.xml"));
} catch (IOException | XmlPullParserException ex) {
ex.printStackTrace();
GitHub connection = GitHub.connectUsingOAuth(config.getGitHubToken());
GHRepository Hadder = connection.getOrganization("BigBotNetwork").getRepository("Hadder");
version = Hadder.getLatestRelease().getTagName();
} catch (IOException ioException) {
ioException.printStackTrace();
}

EmbedBuilder builder = new EmbedBuilder()
.setTitle("Hi!")
.addField("Version", model.getVersion(), false)
.addField("Version", version, 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/nPwjaJk)", true);
builder.addField("Github", "[Click here!](https://github.com/BigBotNetwork/Hadder)", false);
builder.addField("Twitch", "[Click here!](https://www.twitch.tv/bigbotnetwork)", false);
.addField("Guild-Prefix", rethinkServer.getPrefix(), true)
.addField("Join our Dev Server!", "[Click here!](https://discord.gg/nPwjaJk)", true)
.addField("Github", "[Click here!](https://github.com/BigBotNetwork/Hadder)", false)
.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);
Expand Down
Loading

0 comments on commit 02c4312

Please sign in to comment.