Archiviert
1
0

Add AnnouncementListener

Dieser Commit ist enthalten in:
yoyosource 2021-07-28 18:26:12 +02:00
Ursprung 22523fa5be
Commit 536d503f6e
3 geänderte Dateien mit 43 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bungeecore.bot;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.bungeecore.bot.events.EventManager;
import de.steamwar.bungeecore.bot.listeners.AnnouncementListener;
import de.steamwar.bungeecore.bot.listeners.DiscordTicketListener;
import de.steamwar.bungeecore.bot.listeners.RolesInteractionButtonListener;
import de.steamwar.bungeecore.bot.util.DiscordTicketMessage;
@ -76,6 +77,7 @@ public class SteamwarDiscordBot {
new RolesInteractionButtonListener();
new DiscordTicketListener();
new AnnouncementListener();
}
private int index = 0;

Datei anzeigen

@ -30,6 +30,7 @@ public class SteamwarDiscordBotConfig {
public static String TOKEN;
public static String GUILD;
public static String ANNOUNCEMENTS_CHANNEL;
public static String EVENTS_CHANNEL;
public static String ROLES_CHANNEL;
public static String ROLES_BASE_MESSAGE;
@ -50,6 +51,7 @@ public class SteamwarDiscordBotConfig {
public static void loadConfig(Configuration config) {
TOKEN = config.getString("token");
GUILD = config.getString("guild");
ANNOUNCEMENTS_CHANNEL = config.getString("announcements-channel");
EVENTS_CHANNEL = config.getString("events-channel");
Configuration rolesSection = config.getSection("roles-claim");
ROLES_CHANNEL = rolesSection.getString("channel");

Datei anzeigen

@ -0,0 +1,39 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bungeecore.bot.listeners;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import org.jetbrains.annotations.NotNull;
public class AnnouncementListener extends BasicDiscordListener {
@Override
public void onGuildMessageReceived(@NotNull GuildMessageReceivedEvent event) {
if (!event.getChannel().getId().equals(SteamwarDiscordBotConfig.ANNOUNCEMENTS_CHANNEL)) {
return;
}
if (event.getAuthor().isBot()) {
return;
}
Message.broadcast("ALERT", event.getMessage().getContentRaw());
}
}