Add /discord command to display invite code (#4620)

This commit is contained in:
Josh Roy 2021-11-06 19:18:37 -04:00 committed by GitHub
parent 8f679de352
commit 680d3230ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 1 deletions

View File

@ -240,6 +240,11 @@ discordbroadcastCommandUsage1Description=Sends the given message to the specifie
discordbroadcastInvalidChannel=\u00a74Discord channel \u00a7c{0}\u00a74 does not exist. discordbroadcastInvalidChannel=\u00a74Discord channel \u00a7c{0}\u00a74 does not exist.
discordbroadcastPermission=\u00a74You do not have permission to send messages to the \u00a7c{0}\u00a74 channel. discordbroadcastPermission=\u00a74You do not have permission to send messages to the \u00a7c{0}\u00a74 channel.
discordbroadcastSent=\u00a76Message sent to \u00a7c{0}\u00a76! discordbroadcastSent=\u00a76Message sent to \u00a7c{0}\u00a76!
discordCommandDescription=Sends the discord invite link to the player.
discordCommandLink=\u00a76Join our Discord server at \u00a7c{0}\u00a76!
discordCommandUsage=/<command>
discordCommandUsage1=/<command>
discordCommandUsage1Description=Sends the discord invite link to the player
discordCommandExecuteDescription=Executes a console command on the Minecraft server. discordCommandExecuteDescription=Executes a console command on the Minecraft server.
discordCommandExecuteArgumentCommand=The command to be executed discordCommandExecuteArgumentCommand=The command to be executed
discordCommandExecuteReply=Executing command: "/{0}" discordCommandExecuteReply=Executing command: "/{0}"

View File

@ -59,6 +59,10 @@ public class DiscordSettings implements IConf {
return config.getLong("guild", 0); return config.getLong("guild", 0);
} }
public String getDiscordUrl() {
return config.getString("discord-url", "https://discord.gg/invite-code");
}
public long getPrimaryChannelId() { public long getPrimaryChannelId() {
return config.getLong("channels.primary", 0); return config.getLong("channels.primary", 0);
} }

View File

@ -0,0 +1,19 @@
package net.essentialsx.discord.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.commands.EssentialsCommand;
import net.essentialsx.discord.JDADiscordService;
import org.bukkit.Server;
import static com.earth2me.essentials.I18n.tl;
public class Commanddiscord extends EssentialsCommand {
public Commanddiscord() {
super("discord");
}
@Override
protected void run(Server server, CommandSource sender, String commandLabel, String[] args) {
sender.sendMessage(tl("discordCommandLink", ((JDADiscordService) module).getSettings().getDiscordUrl()));
}
}

View File

@ -17,6 +17,9 @@ token: "INSERT-TOKEN-HERE"
# The ID of your server. # The ID of your server.
guild: 000000000000000000 guild: 000000000000000000
# The Discord invite URL that will be shown when a player when using the /discord command or in other areas.
discord-url: "https://discord.gg/invite-code"
# Defined text channels # Defined text channels
# ===================== # =====================
# #

View File

@ -13,3 +13,7 @@ commands:
description: Broadcasts a message to the specified Discord channel. description: Broadcasts a message to the specified Discord channel.
usage: /<command> <channel> <msg> usage: /<command> <channel> <msg>
aliases: [dbroadcast, dbc, dbcast, ediscordbroadcast, edbroadcast, edbc, edbcast] aliases: [dbroadcast, dbc, dbcast, ediscordbroadcast, edbroadcast, edbc, edbcast]
discord:
description: Sends the discord invite link to the player.
usage: /<command>
aliases: [ediscord]