As seen by many IRC bots and the discord webapp itself,
using an input such as s/foo/bar will, depending on the platform, will edit, or resend the last message with the replacement string.
Discord also have a replacement of no content to delete the message from the buffer
This could be useful for editing the last sent message from the deamon
Here's discord's implementation, a bit minified though
searchReplace: {
regex: /^s\/((?:.+?)[^\\]|.)\/(.*)/,
REMOVE_ESCAPE_CHARS: /\\([*?+\/])/g,
action: function(e, t) {
if (!t.isEdit) {
var n = e.content;
e.content = "";
var a = x["default"].getChannelId();
if (a) {
var i = V["default"].getLastEditableMessage(a);
if (i && i.id) {
var r = Array.from(n.match(this.regex) || []),
o = r[1],
s = r[2];
o = o.replace(this.REMOVE_ESCAPE_CHARS, function(e, t) {
return t
}), s = s.replace(this.REMOVE_ESCAPE_CHARS, function(e, t) {
return t
});
var E = i.content.replace(o, s);
E ? E !== i.content && z["default"].editMessage(a, i.id, {
content: E
}) : z["default"].deleteMessage(a, i.id)
}
}
}
}
}
As seen by many IRC bots and the discord webapp itself, using an input such as
s/foo/bar
will, depending on the platform, will edit, or resend the last message with the replacement string. Discord also have a replacement of no content to delete the message from the buffer This could be useful for editing the last sent message from the deamonHere's discord's implementation, a bit minified though