import type { Store, Message } from './store.js';
const tag=/^\s*#([0-9a-hj-km-np-tv-z]{5})\s+(.+)$/is;
export function resolveParent(store:Store,chatId:number,replyToMessageId:number|null,text:string):Message|null {if(replyToMessageId!==null)return store.getByTgMessageId(chatId,replyToMessageId);const m=text.match(tag);return m?store.getMessage(m[1]!.toLowerCase()):null}
export function inboundText(text:string,matchedByHashtag:boolean){if(!matchedByHashtag)return text;return text.match(tag)?.[2]??text}
