Class DiscordBot
java.lang.Object
io.github.dexrnzacattack.rrdiscordbridge.discord.DiscordBot
The Discord bot
-
Field Summary
FieldsModifier and TypeFieldDescriptionnet.dv8tion.jda.api.JDA
The JDA instancenet.dv8tion.jda.api.entities.User
The bot's userfinal Runnable
Updates the player countnet.dv8tion.jda.api.entities.Webhook
The webhookclub.minnced.discord.webhook.WebhookClient
The webhook client -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
editMessage
(String newMessage, net.dv8tion.jda.api.entities.Message msg) Edits an existing messagestatic String
getName
(net.dv8tion.jda.api.entities.Member member) static String
getName
(net.dv8tion.jda.api.entities.User user) Gets the name of a user based on the config settingsvoid
sendEvent
(Settings.Events eventType, net.dv8tion.jda.api.entities.MessageEmbed.AuthorInfo author, String description, Color color, String title) Sends an embed for an eventvoid
sendMessage
(String message) Sends a message to the channelnet.dv8tion.jda.api.entities.Message
sendMessage
(String message, String channel) Sends a message to a channelstatic net.dv8tion.jda.api.entities.Message
sendMessage
(String message, net.dv8tion.jda.api.entities.channel.concrete.TextChannel channel) Sends a message to a channelvoid
sendPlayerEvent
(Settings.Events eventType, String playerName, String description, Color color, String title) Sends an embed that uses the player's info as the author info to the Discord channelvoid
sendPlayerEvent
(Settings.Events eventType, String playerName, String authorName, String description, Color color, String title, String footer) Sends an embed that uses the player's skin as the author picture to the Discord channelvoid
sendPlayerMessage
(Settings.Events eventType, String playerName, String message) Sends a message using a webhook that uses the player's name and skin.void
sendPlayerMessage
(Settings.Events eventType, String playerName, String playerSkinName, String message) Sends a message using a webhook that uses the player's name and skin.void
sendPlayerMessage
(String playerName, String message) Sends a message using a webhook that uses the player's name and skin.static void
sendPlayerMessage
(String playerName, String message, club.minnced.discord.webhook.WebhookClient wc) Sends a message using a provided webhook that uses the player's name and skin.void
sendPlayerMessage
(String playerName, String message, ICancellable event) Sends a message using a webhook that uses the player's name and skin.void
sendPlayerMessage
(String playerName, String playerSkinName, String message) Sends a message using a webhook that uses the player's name and skin.void
Sets the RPC statusvoid
setPlayerCount
(int i) Sets the RPC statusvoid
start()
Starts the botvoid
stop()
Stops the bot
-
Field Details
-
webhookClient
public club.minnced.discord.webhook.WebhookClient webhookClientThe webhook client -
webhook
public net.dv8tion.jda.api.entities.Webhook webhookThe webhook -
self
public net.dv8tion.jda.api.entities.User selfThe bot's user -
jda
public net.dv8tion.jda.api.JDA jdaThe JDA instance -
updatePlayerCountRunnable
Updates the player count
-
-
Constructor Details
-
DiscordBot
public DiscordBot()Creates the bot
-
-
Method Details
-
start
Starts the bot- Throws:
InterruptedException
- If the bot is interrupted while starting
-
stop
public void stop()Stops the bot -
setPlayerCount
public void setPlayerCount()Sets the RPC status -
setPlayerCount
public void setPlayerCount(int i) Sets the RPC status- Parameters:
i
- The new player count
-
getName
-
getName
Gets the name of a user based on the config settings- Parameters:
user
- The user- Returns:
- The name of the user
-
sendPlayerMessage
Sends a message using a webhook that uses the player's name and skin.- Parameters:
playerName
- The name of the player to usemessage
- The message contentevent
- The cancellable event
-
sendPlayerMessage
Sends a message using a webhook that uses the player's name and skin.- Parameters:
playerName
- The player namemessage
- The message
-
sendPlayerMessage
public static void sendPlayerMessage(String playerName, String message, club.minnced.discord.webhook.WebhookClient wc) Sends a message using a provided webhook that uses the player's name and skin.- Parameters:
playerName
- The player namemessage
- The messagewc
- The webhook
-
sendPlayerMessage
Sends a message using a webhook that uses the player's name and skin.- Parameters:
eventType
- The event type (used for Settings.enabledEvents).playerName
- The player namemessage
- The message
-
sendPlayerMessage
Sends a message using a webhook that uses the player's name and skin.- Parameters:
playerName
- The player nameplayerSkinName
- The name of the player that you want to use as the skinmessage
- The message
-
sendPlayerMessage
public void sendPlayerMessage(Settings.Events eventType, String playerName, String playerSkinName, String message) Sends a message using a webhook that uses the player's name and skin.- Parameters:
eventType
- The event type (used for Settings.enabledEvents).playerName
- The player nameplayerSkinName
- The name of the player that you want to use as the skinmessage
- The message
-
sendPlayerEvent
public void sendPlayerEvent(Settings.Events eventType, String playerName, String description, Color color, String title) Sends an embed that uses the player's info as the author info to the Discord channel- Parameters:
eventType
- The event type (used for Settings.enabledEvents).playerName
- The name of the player that you want to be used for the author info.description
- Message in the description part of the embed.color
- Color of the side of the embed.title
- Message in the title part of the embed.
-
sendPlayerEvent
public void sendPlayerEvent(Settings.Events eventType, String playerName, String authorName, String description, Color color, String title, String footer) Sends an embed that uses the player's skin as the author picture to the Discord channel- Parameters:
eventType
- The event type (used for Settings.enabledEvents).playerName
- The name of the player that you want to be used for the author picture.authorName
- The name of the author that you want to be used for the author name.description
- Message in the description part of the embed.color
- Color of the side of the embed.title
- Message in the title part of the embed.footer
- Message in the footer part of the embed
-
sendEvent
public void sendEvent(Settings.Events eventType, net.dv8tion.jda.api.entities.MessageEmbed.AuthorInfo author, String description, Color color, String title) Sends an embed for an event- Parameters:
eventType
- The event type (used for Settings.enabledEvents).author
- The author info.description
- Message in the description part of the embed.color
- Color of the side of the embed.title
- Message in the title part of the embed.
-
sendMessage
Sends a message to the channel- Parameters:
message
- The message
-
sendMessage
public static net.dv8tion.jda.api.entities.Message sendMessage(String message, net.dv8tion.jda.api.entities.channel.concrete.TextChannel channel) Sends a message to a channel- Parameters:
message
- The messagechannel
- The channel to send the message in- Returns:
- The sent message
-
sendMessage
Sends a message to a channel- Parameters:
message
- The messagechannel
- The channel to send the message in
-
editMessage
Edits an existing message- Parameters:
newMessage
- The new message contentmsg
- The message you want to edit
-