Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GlobalReplies] adds messageShort replacement variable #234

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GlobalReplies/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default function Settings() {
<Variable title="{{messageLink}}" desc="Being replaced with the replied message link"/>,
<Variable title="{{channel}}" desc="Being replaced with the channel of the replied message"/>,
<Variable title="{{message}}" desc="Will be replaced with the user message"/>,
<Variable title="{{messageShort}}" desc="Will be replaced with the first 50 characters of user message"/>,
<Variable title="{{newLine}}" desc="Switching to a new line"/>
]}>

Expand Down
2 changes: 1 addition & 1 deletion GlobalReplies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class GlobalReplies extends BasePlugin {
id={`${e.channel.name}-${e.comparator}`}
action={() => {
NavigationUtils.replaceWith(`/channels/${server.id}/${e.channel.id}`);
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", {plainText: Utilities.formatString(this.getTemplate(), {messageLink: `https://discord.com/channels/${server.id}/${channel.id}/${props.message.id}`, author: `<@${props.message.author.id}>`, authorTag: props.message.author.tag, message: props.message.content, channel: `<#${channel.id}>`, newLine: "\n"})})
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", {plainText: Utilities.formatString(this.getTemplate(), {messageLink: `https://discord.com/channels/${server.id}/${channel.id}/${props.message.id}`, author: `<@${props.message.author.id}>`, authorTag: props.message.author.tag, message: props.message.content, messageShort: (props.message.content.length > 50 ? `${props.message.content.slice(0,50)}\u{2026}` : props.message.content).replace(/[\r\n]/gm, ' '), channel: `<#${channel.id}>`, newLine: "\n"})})
}}
label={[
<ChannelText width="10" height="10"/>,
Expand Down