|
6 | 6 | import org.javacord.api.entity.channel.TextChannel; |
7 | 7 | import org.javacord.api.entity.message.Message; |
8 | 8 | import org.javacord.api.entity.message.embed.EmbedBuilder; |
| 9 | +import org.javacord.api.entity.server.Server; |
9 | 10 | import org.javacord.api.util.logging.ExceptionLogger; |
10 | 11 | import org.javacord.bot.Constants; |
11 | 12 | import org.javacord.bot.listeners.CommandCleanupListener; |
@@ -49,13 +50,19 @@ public class DocsCommand implements CommandExecutor { |
49 | 50 | /** |
50 | 51 | * Executes the {@code !docs} command. |
51 | 52 | * |
| 53 | + * @param server The server where the command was issued. |
52 | 54 | * @param channel The channel where the command was issued. |
53 | 55 | * @param message The message the command was issued in. |
54 | 56 | * @param args The arguments given to the command. |
55 | 57 | * @throws IOException If the Javacord icon stream cannot be closed properly. |
56 | 58 | */ |
57 | 59 | @Command(aliases = {"!docs"}, async = true) |
58 | | - public void onCommand(TextChannel channel, Message message, String[] args) throws IOException { |
| 60 | + public void onCommand(Server server, TextChannel channel, Message message, String[] args) throws IOException { |
| 61 | + // Only react in #java_javacord channel on Discord API server |
| 62 | + if ((server.getId() == Constants.DAPI_SERVER_ID) && (channel.getId() != Constants.DAPI_JAVACORD_CHANNEL_ID)) { |
| 63 | + return; |
| 64 | + } |
| 65 | + |
59 | 66 | try (InputStream javacord3Icon = getClass().getClassLoader().getResourceAsStream("javacord3_icon.png")) { |
60 | 67 | EmbedBuilder embed = new EmbedBuilder() |
61 | 68 | .setThumbnail(javacord3Icon, "png") |
|
0 commit comments