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

View File

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

View File

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

View File

@@ -48,7 +48,7 @@ interface 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 { openScreen } = useIntermediate();