mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 15:00:00 +00:00
tags: fix missing member/user variables
This commit is contained in:
parent
33d75af1fc
commit
6923d12aa7
2 changed files with 21 additions and 2 deletions
|
@ -4,6 +4,7 @@ import { MessageContent } from "eris";
|
||||||
import { TemplateParseError } from "../../../templateFormatter";
|
import { TemplateParseError } from "../../../templateFormatter";
|
||||||
import { sendErrorMessage } from "../../../pluginUtils";
|
import { sendErrorMessage } from "../../../pluginUtils";
|
||||||
import { renderTagBody } from "../util/renderTagBody";
|
import { renderTagBody } from "../util/renderTagBody";
|
||||||
|
import { stripObjectToScalars } from "../../../utils";
|
||||||
|
|
||||||
export const TagEvalCmd = tagsCmd({
|
export const TagEvalCmd = tagsCmd({
|
||||||
trigger: "tag eval",
|
trigger: "tag eval",
|
||||||
|
@ -15,7 +16,16 @@ export const TagEvalCmd = tagsCmd({
|
||||||
|
|
||||||
async run({ message: msg, args, pluginData }) {
|
async run({ message: msg, args, pluginData }) {
|
||||||
try {
|
try {
|
||||||
const rendered = await renderTagBody(pluginData, args.body, [], {}, { member: msg.member });
|
const rendered = await renderTagBody(
|
||||||
|
pluginData,
|
||||||
|
args.body,
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
member: stripObjectToScalars(msg.member, ["user"]),
|
||||||
|
user: stripObjectToScalars(msg.member.user),
|
||||||
|
},
|
||||||
|
{ member: msg.member },
|
||||||
|
);
|
||||||
msg.channel.createMessage(rendered);
|
msg.channel.createMessage(rendered);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof TemplateParseError) {
|
if (e instanceof TemplateParseError) {
|
||||||
|
|
|
@ -23,7 +23,16 @@ export async function renderTagFromString(
|
||||||
|
|
||||||
// Format the string
|
// Format the string
|
||||||
try {
|
try {
|
||||||
return renderTagBody(pluginData, tagBody, tagArgs, {}, { member });
|
return renderTagBody(
|
||||||
|
pluginData,
|
||||||
|
tagBody,
|
||||||
|
tagArgs,
|
||||||
|
{
|
||||||
|
member: stripObjectToScalars(member, ["user"]),
|
||||||
|
user: stripObjectToScalars(member.user),
|
||||||
|
},
|
||||||
|
{ member },
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof TemplateParseError) {
|
if (e instanceof TemplateParseError) {
|
||||||
const logs = pluginData.getPlugin(LogsPlugin);
|
const logs = pluginData.getPlugin(LogsPlugin);
|
||||||
|
|
Loading…
Add table
Reference in a new issue