Commit f761a147 authored by nanahira's avatar nanahira

fix

parent 2d177ee0
Pipeline #43340 passed with stages
in 1 minute and 34 seconds
...@@ -145,21 +145,22 @@ export class Client { ...@@ -145,21 +145,22 @@ export class Client {
if (this.isInternal) { if (this.isInternal) {
return; return;
} }
const normalizedType = typeof type === 'number' ? type : ChatColor.BABYBLUE;
const elements = h.normalize(msg) as KoishiElement[]; const elements = h.normalize(msg) as KoishiElement[];
const tokens = await collectKoishiTextTokens(elements, (element) => const tokens = await collectKoishiTextTokens(
this.resolveSendChatElement(element, normalizedType), elements,
(element) => this.resolveSendChatElement(element, type),
type,
); );
if (type <= NetPlayerType.OBSERVER) { if (type <= NetPlayerType.OBSERVER) {
return this.send( return this.send(
new YGOProStocChat().fromPartial({ new YGOProStocChat().fromPartial({
msg: tokens.map((token) => token.text).join(''), msg: tokens.map((token) => token.text).join(''),
player_type: normalizedType, player_type: type,
}), }),
); );
} }
const messages = splitColoredMessagesByLine( const messages = splitColoredMessagesByLine(
resolveColoredMessages(tokens, normalizedType), resolveColoredMessages(tokens, type),
); );
if (!messages.length) { if (!messages.length) {
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment