fix: remove explicit cast to string for msg.content

This commit is contained in:
Paul Makles 2022-05-21 16:59:34 +01:00
parent 73d51a3e29
commit 6fcdbd1cef
4 changed files with 8 additions and 5 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit bac88cffd196a2afacf7d726e4f7ef19bd6bd94c Subproject commit 9f9f1bf8ee2ce099fec081a3aa2405c4c1d22678

View file

@ -57,7 +57,7 @@ const Message = observer(
const { openScreen } = useIntermediate(); const { openScreen } = useIntermediate();
const content = message.content as string; const content = message.content;
const head = const head =
preferHead || (message.reply_ids && message.reply_ids.length > 0); preferHead || (message.reply_ids && message.reply_ids.length > 0);
@ -168,7 +168,10 @@ const Message = observer(
<Attachment <Attachment
key={index} key={index}
attachment={attachment} attachment={attachment}
hasContent={index > 0 || content.length > 0} hasContent={
index > 0 ||
(content ? content.length > 0 : false)
}
/> />
))} ))}
{message.embeds?.map((embed, index) => ( {message.embeds?.map((embed, index) => (

View file

@ -209,7 +209,7 @@ export default function ContextMenus() {
.get(data.message.channel)! .get(data.message.channel)!
.sendMessage({ .sendMessage({
nonce: data.message.id, nonce: data.message.id,
content: data.message.data.content as string, content: data.message.data.content,
replies: data.message.data.replies, replies: data.message.data.replies,
}) })
.catch(fail); .catch(fail);

View file

@ -48,7 +48,7 @@ interface Props {
} }
export default function MessageEditor({ message, finish }: Props) { export default function MessageEditor({ message, finish }: Props) {
const [content, setContent] = useState((message.content as string) ?? ""); const [content, setContent] = useState(message.content ?? "");
const { focusTaken } = useContext(IntermediateContext); const { focusTaken } = useContext(IntermediateContext);
const { openScreen } = useIntermediate(); const { openScreen } = useIntermediate();