discord-jadx/app/src/main/java/com/discord/utilities/textprocessing/MessageUnparser$getChannelM...

48 lines
1.9 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 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 J = a.J('#');
J.append(AnimatableValueParser.y0(channel));
str = J.toString();
} else {
str = matcher.group();
}
m.checkNotNullExpressionValue(str, "content");
c.a.u.b.a.a aVar = new c.a.u.b.a.a(str);
m.checkNotNullParameter(aVar, "node");
return new ParseSpec<>(aVar, s2);
}
}