@@ -92,7 +92,7 @@ private static synchronized IMessage sendSingleMessage(final IChannel channel, f
92
92
93
93
private static synchronized IMessage sendSingleMessage (final IChannel channel , final String message , final int tries ){
94
94
try {
95
- return channel .sendMessage (message );
95
+ return channel .sendMessage (sanitizeMessage ( message ) );
96
96
}
97
97
catch (RateLimitException rle ) {
98
98
if (tries > 0 ) {
@@ -175,9 +175,9 @@ public static synchronized IMessage sendFile(final IChannel channel, final Strin
175
175
return sendFile (channel , content , file , 20 );
176
176
}
177
177
178
- private static IMessage sendFile (final IChannel channel , final String content , final File file , final int tries ) {
178
+ private static IMessage sendFile (final IChannel channel , final String message , final File file , final int tries ) {
179
179
try {
180
- return channel .sendFile (content , file );
180
+ return channel .sendFile (sanitizeMessage ( message ) , file );
181
181
}
182
182
catch (RateLimitException rle ) {
183
183
if (tries > 0 ) {
@@ -191,7 +191,7 @@ private static IMessage sendFile(final IChannel channel, final String content, f
191
191
Thread .currentThread ().interrupt ();
192
192
}
193
193
194
- return sendFile (channel , content , file , tries - 1 );
194
+ return sendFile (channel , message , file , tries - 1 );
195
195
}
196
196
else {
197
197
LOG .warn ("Bot was ratelimited while trying to send file." , rle );
@@ -207,6 +207,16 @@ private static IMessage sendFile(final IChannel channel, final String content, f
207
207
return null ;
208
208
}
209
209
210
+ /**
211
+ * Sanitize a message by replacing "@everyone" with "(at)everyone"
212
+ *
213
+ * @param message The message to be sanitized
214
+ * @return The sanitized message
215
+ */
216
+ public static String sanitizeMessage (final String message ) {
217
+ return message .replaceAll ("@everyone" , "(at)everyone" );
218
+ }
219
+
210
220
/**
211
221
* Send a notification about an error to a channel.
212
222
*
0 commit comments