48 lines
2 KiB
Java
48 lines
2 KiB
Java
package com.discord.utilities.textprocessing;
|
|
|
|
import c.d.b.a.a;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.simpleast.core.node.Node;
|
|
import com.discord.simpleast.core.parser.ParseSpec;
|
|
import com.discord.simpleast.core.parser.Parser;
|
|
import com.discord.simpleast.core.parser.Rule;
|
|
import com.discord.widgets.chat.input.MentionUtilsKt;
|
|
import d0.g0.s;
|
|
import d0.z.d.m;
|
|
import java.util.Map;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
/* compiled from: MessageUnparser.kt */
|
|
public final class MessageUnparser$getChannelMentionRule$1 extends Rule<T, Node<T>, S> {
|
|
public final /* synthetic */ Map $channels;
|
|
public final /* synthetic */ MessageUnparser this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public MessageUnparser$getChannelMentionRule$1(MessageUnparser messageUnparser, Map map, Pattern pattern) {
|
|
super(pattern);
|
|
this.this$0 = messageUnparser;
|
|
this.$channels = map;
|
|
}
|
|
|
|
@Override // com.discord.simpleast.core.parser.Rule
|
|
public ParseSpec<T, S> parse(Matcher matcher, Parser<T, ? super Node<T>, S> parser, S s2) {
|
|
String str;
|
|
Long longOrNull;
|
|
m.checkNotNullParameter(matcher, "matcher");
|
|
m.checkNotNullParameter(parser, "parser");
|
|
String group = matcher.group(1);
|
|
Channel channel = (Channel) this.$channels.get(Long.valueOf((group == null || (longOrNull = s.toLongOrNull(group)) == null) ? -1 : longOrNull.longValue()));
|
|
if (channel != null) {
|
|
StringBuilder N = a.N(MentionUtilsKt.CHANNELS_CHAR);
|
|
N.append(AnimatableValueParser.y0(channel));
|
|
str = N.toString();
|
|
} else {
|
|
str = matcher.group();
|
|
}
|
|
m.checkNotNullExpressionValue(str, "content");
|
|
c.a.t.b.a.a aVar = new c.a.t.b.a.a(str);
|
|
m.checkNotNullParameter(aVar, "node");
|
|
return new ParseSpec<>(aVar, s2);
|
|
}
|
|
}
|