CTCV2/app/src/main/java/f/a/p/b/a/u.java

34 lines
1.1 KiB
Java

package f.a.p.b.a;
import com.PatchConfig;
import com.discord.widgets.chat.input.WidgetChatInputCommandsModel;
import com.discord.widgets.chat.input.WidgetChatInputSlashAction;
import lanchon.dexpatcher.annotation.DexEdit;
import lanchon.dexpatcher.annotation.DexWrap;
// If we need to find this again in the future there should only be one class that implements WidgetChatInputSlashAction
@DexEdit
public final class u implements WidgetChatInputSlashAction {
// slashcommands patch
@DexWrap
@Override
public String call(String str, WidgetChatInputCommandsModel widgetChatInputCommandsModel) {
if (!PatchConfig.SLASH_COMMANDS_ENABLED) {
// Patch not enabled
return call(str, widgetChatInputCommandsModel);
}
// We handle our commands elswhere so bail out here.
if (widgetChatInputCommandsModel.getSlashOutput().equals("{CTC_COMMAND}")) {
return str;
}
String replaceAll = str.replaceAll(widgetChatInputCommandsModel.getTag(), "");
return replaceAll + ' ' + widgetChatInputCommandsModel.getSlashOutput();
}
}