mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Add various new tag functions (#195)
This commit is contained in:
parent
eab26a28df
commit
38ab38645b
3 changed files with 26 additions and 1 deletions
|
@ -203,7 +203,7 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()("tags", {
|
|||
return "";
|
||||
}
|
||||
|
||||
if (input.match(/^<(?:@(?:!|&)?|#)\d+>$/)) {
|
||||
if (input.match(/^<(?:@[!&]?|#)\d+>$/)) {
|
||||
return input;
|
||||
}
|
||||
|
||||
|
@ -217,6 +217,14 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()("tags", {
|
|||
|
||||
return "";
|
||||
},
|
||||
|
||||
isMention: input => {
|
||||
if (typeof input !== "string") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return /^<(?:@[!&]?|#)\d+>$/.test(input);
|
||||
},
|
||||
};
|
||||
|
||||
for (const [name, fn] of Object.entries(state.tagFunctions)) {
|
||||
|
|
|
@ -25,6 +25,11 @@ export async function renderTagBody(
|
|||
if (typeof name !== "string") return;
|
||||
dynamicVars[name] = val;
|
||||
},
|
||||
setr(name, val) {
|
||||
if (typeof name !== "string") return "";
|
||||
dynamicVars[name] = val;
|
||||
return val;
|
||||
},
|
||||
get(name) {
|
||||
return dynamicVars[name] == null ? "" : dynamicVars[name];
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue