mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Merge pull request #26 from roflmaoqwerty/custom-success-emoji
Custom success emoji
This commit is contained in:
commit
21fdd76863
16 changed files with 102 additions and 110 deletions
|
@ -16,6 +16,7 @@ for (const pluginClass of availablePlugins) {
|
||||||
const guildConfigRootSchema = t.type({
|
const guildConfigRootSchema = t.type({
|
||||||
prefix: t.string,
|
prefix: t.string,
|
||||||
levels: t.record(t.string, t.number),
|
levels: t.record(t.string, t.number),
|
||||||
|
success_emoji: t.string,
|
||||||
plugins: t.record(t.string, t.unknown),
|
plugins: t.record(t.string, t.unknown),
|
||||||
});
|
});
|
||||||
const partialGuildConfigRootSchema = t.partial(guildConfigRootSchema.props);
|
const partialGuildConfigRootSchema = t.partial(guildConfigRootSchema.props);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import yaml from "js-yaml";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
const fsp = fs.promises;
|
const fsp = fs.promises;
|
||||||
|
|
||||||
import { Knub, logger, PluginError, Plugin, IGlobalConfig, IGuildConfig } from "knub";
|
import { Knub, logger, PluginError, Plugin, IGlobalConfig, IGuildConfig, IGuildData } from "knub";
|
||||||
import { SimpleError } from "./SimpleError";
|
import { SimpleError } from "./SimpleError";
|
||||||
|
|
||||||
import DiscordRESTError from "eris/lib/errors/DiscordRESTError"; // tslint:disable-line
|
import DiscordRESTError from "eris/lib/errors/DiscordRESTError"; // tslint:disable-line
|
||||||
|
@ -67,7 +67,7 @@ for (const [i, part] of actualVersionParts.entries()) {
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
moment.tz.setDefault("UTC");
|
moment.tz.setDefault("UTC");
|
||||||
|
|
||||||
import { Client } from "eris";
|
import { Client, TextableChannel, TextChannel } from "eris";
|
||||||
import { connect } from "./data/db";
|
import { connect } from "./data/db";
|
||||||
import { availablePlugins, availableGlobalPlugins, basePlugins } from "./plugins/availablePlugins";
|
import { availablePlugins, availableGlobalPlugins, basePlugins } from "./plugins/availablePlugins";
|
||||||
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
|
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
|
||||||
|
@ -162,7 +162,9 @@ connect().then(async conn => {
|
||||||
customArgumentTypes,
|
customArgumentTypes,
|
||||||
|
|
||||||
sendSuccessMessageFn(channel, body) {
|
sendSuccessMessageFn(channel, body) {
|
||||||
channel.createMessage(successMessage(body));
|
const guildId = channel instanceof TextChannel ? channel.guild.id : null;
|
||||||
|
const emoji = (guildId ? bot.getGuildData(guildId).config.success_emoji : null) ?? "default emoji here";
|
||||||
|
channel.createMessage(successMessage(body, emoji));
|
||||||
},
|
},
|
||||||
|
|
||||||
sendErrorMessageFn(channel, body) {
|
sendErrorMessageFn(channel, body) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ export class AutoReactionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.autoReactions.set(args.channelId, finalReactions);
|
await this.autoReactions.set(args.channelId, finalReactions);
|
||||||
msg.channel.createMessage(successMessage(`Auto-reactions set for <#${args.channelId}>`));
|
this.sendSuccessMessage(msg.channel, `Auto-reactions set for <#${args.channelId}>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("auto_reactions disable", "<channelId:channelId>", {
|
@d.command("auto_reactions disable", "<channelId:channelId>", {
|
||||||
|
@ -112,7 +112,7 @@ export class AutoReactionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.autoReactions.removeFromChannel(args.channelId);
|
await this.autoReactions.removeFromChannel(args.channelId);
|
||||||
msg.channel.createMessage(successMessage(`Auto-reactions disabled in <#${args.channelId}>`));
|
this.sendSuccessMessage(msg.channel, `Auto-reactions disabled in <#${args.channelId}>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async onMessageCreate(msg: SavedMessage) {
|
async onMessageCreate(msg: SavedMessage) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export class BotControlPlugin extends GlobalZeppelinPlugin<TConfigSchema> {
|
||||||
if (guild) {
|
if (guild) {
|
||||||
const channel = guild.channels.get(channelId);
|
const channel = guild.channels.get(channelId);
|
||||||
if (channel instanceof TextChannel) {
|
if (channel instanceof TextChannel) {
|
||||||
channel.createMessage(successMessage("Global plugins reloaded!"));
|
this.sendSuccessMessage(channel, "Global plugins reloaded!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ export class BotControlPlugin extends GlobalZeppelinPlugin<TConfigSchema> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage(`Left guild **${guildName}**`));
|
this.sendSuccessMessage(msg.channel, `Left guild **${guildName}**`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("reload_guild", "<guildId:string>")
|
@d.command("reload_guild", "<guildId:string>")
|
||||||
|
@ -176,7 +176,7 @@ export class BotControlPlugin extends GlobalZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const guild = this.bot.guilds.get(args.guildId);
|
const guild = this.bot.guilds.get(args.guildId);
|
||||||
msg.channel.createMessage(successMessage(`Reloaded guild **${guild.name}**`));
|
this.sendSuccessMessage(msg.channel, `Reloaded guild **${guild.name}**`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("reload_all_guilds")
|
@d.command("reload_all_guilds")
|
||||||
|
@ -203,7 +203,7 @@ export class BotControlPlugin extends GlobalZeppelinPlugin<TConfigSchema> {
|
||||||
});
|
});
|
||||||
createChunkedMessage(msg.channel, `Reloaded ${reloadCount} guild(s). Errors:\n${errorLines.join("\n")}`);
|
createChunkedMessage(msg.channel, `Reloaded ${reloadCount} guild(s). Errors:\n${errorLines.join("\n")}`);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(successMessage(`Reloaded ${reloadCount} guild(s)`));
|
this.sendSuccessMessage(msg.channel, `Reloaded ${reloadCount} guild(s)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ export class LocatePlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const toDelete = alerts[args.num - 1];
|
const toDelete = alerts[args.num - 1];
|
||||||
await this.alerts.delete(toDelete.id);
|
await this.alerts.delete(toDelete.id);
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage("Alert deleted"));
|
this.sendSuccessMessage(msg.channel, "Alert deleted");
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.event("voiceChannelJoin")
|
@d.event("voiceChannelJoin")
|
||||||
|
|
|
@ -108,14 +108,12 @@ export class MessageSaverPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const { savedCount, failed } = await this.saveMessagesToDB(args.channel, args.ids);
|
const { savedCount, failed } = await this.saveMessagesToDB(args.channel, args.ids);
|
||||||
|
|
||||||
if (failed.length) {
|
if (failed.length) {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}
|
`Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`,
|
||||||
`,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(successMessage(`Saved ${savedCount} messages!`));
|
this.sendSuccessMessage(msg.channel, `Saved ${savedCount} messages!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,14 +129,12 @@ export class MessageSaverPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (failed.length) {
|
if (failed.length) {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}
|
`Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`,
|
||||||
`,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(successMessage(`Saved ${savedCount} messages!`));
|
this.sendSuccessMessage(msg.channel, `Saved ${savedCount} messages!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,7 +530,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
note,
|
note,
|
||||||
});
|
});
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage(`Case \`#${theCase.case_number}\` updated`));
|
this.sendSuccessMessage(msg.channel, `Case \`#${theCase.case_number}\` updated`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("note", "<user:string> <note:string$>", {
|
@d.command("note", "<user:string> <note:string$>", {
|
||||||
|
@ -624,10 +624,9 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
const messageResultText = warnResult.notifyResult.text ? ` (${warnResult.notifyResult.text})` : "";
|
const messageResultText = warnResult.notifyResult.text ? ` (${warnResult.notifyResult.text})` : "";
|
||||||
|
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`Warned **${memberToWarn.user.username}#${memberToWarn.user.discriminator}** (Case #${warnResult.case.case_number})${messageResultText}`,
|
`Warned **${memberToWarn.user.username}#${memberToWarn.user.discriminator}** (Case #${warnResult.case.case_number})${messageResultText}`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,22 +861,20 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
// Confirm the action to the moderator
|
// Confirm the action to the moderator
|
||||||
if (args.time) {
|
if (args.time) {
|
||||||
const timeUntilUnmute = args.time && humanizeDuration(args.time);
|
const timeUntilUnmute = args.time && humanizeDuration(args.time);
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
asSingleLine(`
|
asSingleLine(`
|
||||||
Unmuting **${user.username}#${user.discriminator}**
|
Unmuting **${user.username}#${user.discriminator}**
|
||||||
in ${timeUntilUnmute} (Case #${result.case.case_number})
|
in ${timeUntilUnmute} (Case #${result.case.case_number})
|
||||||
`),
|
`),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
asSingleLine(`
|
asSingleLine(`
|
||||||
Unmuted **${user.username}#${user.discriminator}**
|
Unmuted **${user.username}#${user.discriminator}**
|
||||||
(Case #${result.case.case_number})
|
(Case #${result.case.case_number})
|
||||||
`),
|
`),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1019,7 +1016,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
let response = `Kicked **${memberToKick.user.username}#${memberToKick.user.discriminator}** (Case #${kickResult.case.case_number})`;
|
let response = `Kicked **${memberToKick.user.username}#${memberToKick.user.discriminator}** (Case #${kickResult.case.case_number})`;
|
||||||
|
|
||||||
if (kickResult.notifyResult.text) response += ` (${kickResult.notifyResult.text})`;
|
if (kickResult.notifyResult.text) response += ` (${kickResult.notifyResult.text})`;
|
||||||
msg.channel.createMessage(successMessage(response));
|
this.sendSuccessMessage(msg.channel, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("ban", "<user:string> [reason:string$]", {
|
@d.command("ban", "<user:string> [reason:string$]", {
|
||||||
|
@ -1080,7 +1077,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
let response = `Banned **${memberToBan.user.username}#${memberToBan.user.discriminator}** (Case #${banResult.case.case_number})`;
|
let response = `Banned **${memberToBan.user.username}#${memberToBan.user.discriminator}** (Case #${banResult.case.case_number})`;
|
||||||
|
|
||||||
if (banResult.notifyResult.text) response += ` (${banResult.notifyResult.text})`;
|
if (banResult.notifyResult.text) response += ` (${banResult.notifyResult.text})`;
|
||||||
msg.channel.createMessage(successMessage(response));
|
this.sendSuccessMessage(msg.channel, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("softban", "<user:string> [reason:string$]", {
|
@d.command("softban", "<user:string> [reason:string$]", {
|
||||||
|
@ -1160,10 +1157,9 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Confirm the action to the moderator
|
// Confirm the action to the moderator
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`Softbanned **${memberToSoftban.user.username}#${memberToSoftban.user.discriminator}** (Case #${createdCase.case_number})`,
|
`Softbanned **${memberToSoftban.user.username}#${memberToSoftban.user.discriminator}** (Case #${createdCase.case_number})`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Log the action
|
// Log the action
|
||||||
|
@ -1220,7 +1216,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Confirm the action
|
// Confirm the action
|
||||||
msg.channel.createMessage(successMessage(`Member unbanned (Case #${createdCase.case_number})`));
|
this.sendSuccessMessage(msg.channel, `Member unbanned (Case #${createdCase.case_number})`);
|
||||||
|
|
||||||
// Log the action
|
// Log the action
|
||||||
this.serverLogs.log(LogType.MEMBER_UNBAN, {
|
this.serverLogs.log(LogType.MEMBER_UNBAN, {
|
||||||
|
@ -1290,7 +1286,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Confirm the action
|
// Confirm the action
|
||||||
msg.channel.createMessage(successMessage(`Member forcebanned (Case #${createdCase.case_number})`));
|
this.sendSuccessMessage(msg.channel, `Member forcebanned (Case #${createdCase.case_number})`);
|
||||||
|
|
||||||
// Log the action
|
// Log the action
|
||||||
this.serverLogs.log(LogType.MEMBER_FORCEBAN, {
|
this.serverLogs.log(LogType.MEMBER_FORCEBAN, {
|
||||||
|
@ -1378,11 +1374,12 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (failedBans.length) {
|
if (failedBans.length) {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(`Banned ${successfulBanCount} users, ${failedBans.length} failed: ${failedBans.join(" ")}`),
|
msg.channel,
|
||||||
|
`Banned ${successfulBanCount} users, ${failedBans.length} failed: ${failedBans.join(" ")}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(successMessage(`Banned ${successfulBanCount} users successfully`));
|
this.sendSuccessMessage(msg.channel, `Banned ${successfulBanCount} users successfully`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1438,11 +1435,12 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(`Case #${theCase.case_number} created for **${user.username}#${user.discriminator}**`),
|
msg.channel,
|
||||||
|
`Case #${theCase.case_number} created for **${user.username}#${user.discriminator}**`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(successMessage(`Case #${theCase.case_number} created`));
|
this.sendSuccessMessage(msg.channel, `Case #${theCase.case_number} created`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the action
|
// Log the action
|
||||||
|
@ -1603,8 +1601,9 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.cases.setHidden(theCase.id, true);
|
await this.cases.setHidden(theCase.id, true);
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(`Case #${theCase.case_number} is now hidden! Use \`unhidecase\` to unhide it.`),
|
msg.channel,
|
||||||
|
`Case #${theCase.case_number} is now hidden! Use \`unhidecase\` to unhide it.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,7 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
// let the user know we are done
|
// let the user know we are done
|
||||||
if (chunks.length > 2) {
|
if (chunks.length > 2) {
|
||||||
msg.channel.createMessage(successMessage("All mutes for the specified filters posted!"));
|
this.sendSuccessMessage(msg.channel, "All mutes for the specified filters posted!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage(`Cleared ${cleared} mutes from banned users!`));
|
this.sendSuccessMessage(msg.channel, `Cleared ${cleared} mutes from banned users!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -572,7 +572,7 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage(`Cleared ${cleared} mutes from members that don't have the mute role`));
|
this.sendSuccessMessage(msg.channel, `Cleared ${cleared} mutes from members that don't have the mute role`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("clear_mute", "<userId:string>")
|
@d.command("clear_mute", "<userId:string>")
|
||||||
|
@ -585,7 +585,7 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.mutes.clear(args.userId);
|
await this.mutes.clear(args.userId);
|
||||||
msg.channel.createMessage(successMessage(`Active mute cleared`));
|
this.sendSuccessMessage(msg.channel, `Active mute cleared`);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async clearExpiredMutes() {
|
protected async clearExpiredMutes() {
|
||||||
|
|
|
@ -69,9 +69,7 @@ export class PingableRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
await this.pingableRoles.delete(args.channelId, args.role.id);
|
await this.pingableRoles.delete(args.channelId, args.role.id);
|
||||||
this.cache.delete(args.channelId);
|
this.cache.delete(args.channelId);
|
||||||
|
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(msg.channel, `**${args.role.name}** is no longer set as pingable in <#${args.channelId}>`);
|
||||||
successMessage(`**${args.role.name}** is no longer set as pingable in <#${args.channelId}>`),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("pingable_role", "<channelId:channelId> <role:role>")
|
@d.command("pingable_role", "<channelId:channelId> <role:role>")
|
||||||
|
@ -88,7 +86,7 @@ export class PingableRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
await this.pingableRoles.add(args.channelId, args.role.id);
|
await this.pingableRoles.add(args.channelId, args.role.id);
|
||||||
this.cache.delete(args.channelId);
|
this.cache.delete(args.channelId);
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage(`**${args.role.name}** has been set as pingable in <#${args.channelId}>`));
|
this.sendSuccessMessage(msg.channel, `**${args.role.name}** has been set as pingable in <#${args.channelId}>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.event("typingStart")
|
@d.event("typingStart")
|
||||||
|
|
|
@ -237,7 +237,7 @@ export class ReactionRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const targetMessage = await channel.getMessage(savedMessage.id);
|
const targetMessage = await channel.getMessage(savedMessage.id);
|
||||||
await targetMessage.removeReactions();
|
await targetMessage.removeReactions();
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage("Reaction roles cleared"));
|
this.sendSuccessMessage(msg.channel, "Reaction roles cleared");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -259,7 +259,7 @@ export class ReactionRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
await this.refreshReactionRoles(savedMessage.channel_id, savedMessage.id);
|
await this.refreshReactionRoles(savedMessage.channel_id, savedMessage.id);
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage("Reaction roles refreshed"));
|
this.sendSuccessMessage(msg.channel, "Reaction roles refreshed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,7 +346,7 @@ export class ReactionRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const reactionRoles = await this.reactionRoles.getForMessage(targetMessage.id);
|
const reactionRoles = await this.reactionRoles.getForMessage(targetMessage.id);
|
||||||
await this.applyReactionRoleReactionsToMessage(targetMessage.channel.id, targetMessage.id, reactionRoles);
|
await this.applyReactionRoleReactionsToMessage(targetMessage.channel.id, targetMessage.id, reactionRoles);
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage("Reaction roles added"));
|
this.sendSuccessMessage(msg.channel, "Reaction roles added");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -147,10 +147,9 @@ export class RemindersPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
const msUntilReminder = reminderTime.diff(now);
|
const msUntilReminder = reminderTime.diff(now);
|
||||||
const timeUntilReminder = humanizeDuration(msUntilReminder, { largest: 2, round: true });
|
const timeUntilReminder = humanizeDuration(msUntilReminder, { largest: 2, round: true });
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`I will remind you in **${timeUntilReminder}** at **${reminderTime.format("YYYY-MM-DD, HH:mm")}**`,
|
`I will remind you in **${timeUntilReminder}** at **${reminderTime.format("YYYY-MM-DD, HH:mm")}**`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +193,6 @@ export class RemindersPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const toDelete = reminders[args.num - 1];
|
const toDelete = reminders[args.num - 1];
|
||||||
await this.reminders.delete(toDelete.id);
|
await this.reminders.delete(toDelete.id);
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage("Reminder deleted"));
|
this.sendSuccessMessage(msg.channel, "Reminder deleted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,19 +109,19 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const removedRolesWord = rolesToRemoveArr.length === 1 ? "role" : "roles";
|
const removedRolesWord = rolesToRemoveArr.length === 1 ? "role" : "roles";
|
||||||
|
|
||||||
if (nonMatchingRoleNames.length) {
|
if (nonMatchingRoleNames.length) {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` +
|
`<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` +
|
||||||
` couldn't recognize the other roles you mentioned`,
|
` couldn't recognize the other roles you mentioned`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(`<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`),
|
msg.channel,
|
||||||
|
`<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
msg.channel.createMessage(errorMessage(`<@!${msg.author.id}> Got an error while trying to remove the roles`));
|
this.sendSuccessMessage(msg.channel, `<@!${msg.author.id}> Got an error while trying to remove the roles`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(
|
msg.channel.createMessage(
|
||||||
|
@ -193,15 +193,15 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const grantedRolesWord = rolesToGrantArr.length === 1 ? "role" : "roles";
|
const grantedRolesWord = rolesToGrantArr.length === 1 ? "role" : "roles";
|
||||||
|
|
||||||
if (nonMatchingRoleNames.length) {
|
if (nonMatchingRoleNames.length) {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`<@!${msg.author.id}> Granted you the ${grantedRolesStr.join(", ")} ${grantedRolesWord};` +
|
`<@!${msg.author.id}> Granted you the ${grantedRolesStr.join(", ")} ${grantedRolesWord};` +
|
||||||
` couldn't recognize the other roles you mentioned`,
|
` couldn't recognize the other roles you mentioned`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(`<@!${msg.author.id}> Granted you the ${grantedRolesStr.join(", ")} ${grantedRolesWord}`),
|
msg.channel,
|
||||||
|
`<@!${msg.author.id}> Granted you the ${grantedRolesStr.join(", ")} ${grantedRolesWord}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -283,9 +283,7 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
// Add new one
|
// Add new one
|
||||||
await this.selfGrantableRoles.add(args.channel.id, role.id, uniqueAliases);
|
await this.selfGrantableRoles.add(args.channel.id, role.id, uniqueAliases);
|
||||||
|
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(msg.channel, `Self-grantable role **${role.name}** added to **#${args.channel.name}**`);
|
||||||
successMessage(`Self-grantable role **${role.name}** added to **#${args.channel.name}**`),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("self_grantable_roles delete", "<channel:channel> <roleId:string>")
|
@d.command("self_grantable_roles delete", "<channel:channel> <roleId:string>")
|
||||||
|
@ -295,9 +293,7 @@ export class SelfGrantableRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
const roleName = this.guild.roles.has(args.roleId) ? this.guild.roles.get(args.roleId).name : args.roleId;
|
const roleName = this.guild.roles.has(args.roleId) ? this.guild.roles.get(args.roleId).name : args.roleId;
|
||||||
|
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(msg.channel, `Self-grantable role **${roleName}** removed from **#${args.channel.name}**`);
|
||||||
successMessage(`Self-grantable role **${roleName}** removed from **#${args.channel.name}**`),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("self_grantable_roles", "<channel:channel>")
|
@d.command("self_grantable_roles", "<channel:channel>")
|
||||||
|
|
|
@ -194,13 +194,12 @@ export class SlowmodePlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failedUsers.length) {
|
if (failedUsers.length) {
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(
|
msg.channel,
|
||||||
`Slowmode disabled! Failed to clear slowmode from the following users:\n\n<@!${failedUsers.join(">\n<@!")}>`,
|
`Slowmode disabled! Failed to clear slowmode from the following users:\n\n<@!${failedUsers.join(">\n<@!")}>`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.createMessage(successMessage("Slowmode disabled!"));
|
this.sendSuccessMessage(msg.channel, "Slowmode disabled!");
|
||||||
initMsg.delete().catch(noop);
|
initMsg.delete().catch(noop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ export class TagsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.tags.delete(args.tag);
|
await this.tags.delete(args.tag);
|
||||||
msg.channel.createMessage(successMessage("Tag deleted!"));
|
this.sendSuccessMessage(msg.channel, "Tag deleted!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("tag eval", "<body:string$>")
|
@d.command("tag eval", "<body:string$>")
|
||||||
|
@ -180,7 +180,7 @@ export class TagsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
await this.tags.createOrUpdate(args.tag, args.body, msg.author.id);
|
await this.tags.createOrUpdate(args.tag, args.body, msg.author.id);
|
||||||
|
|
||||||
const prefix = this.getConfig().prefix;
|
const prefix = this.getConfig().prefix;
|
||||||
msg.channel.createMessage(successMessage(`Tag set! Use it with: \`${prefix}${args.tag}\``));
|
this.sendSuccessMessage(msg.channel, `Tag set! Use it with: \`${prefix}${args.tag}\``);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("tag", "<tag:string>", {
|
@d.command("tag", "<tag:string>", {
|
||||||
|
|
|
@ -176,7 +176,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
this.lastReload = Date.now();
|
this.lastReload = Date.now();
|
||||||
|
|
||||||
if (activeReloads && activeReloads.has(this.guildId)) {
|
if (activeReloads && activeReloads.has(this.guildId)) {
|
||||||
activeReloads.get(this.guildId).createMessage(successMessage("Reloaded!"));
|
this.sendSuccessMessage(activeReloads.get(this.guildId), "Reloaded!");
|
||||||
activeReloads.delete(this.guildId);
|
activeReloads.delete(this.guildId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -770,7 +770,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
responseText += ` in <#${targetChannel.id}>\n${cleanResult.archiveUrl}`;
|
responseText += ` in <#${targetChannel.id}>\n${cleanResult.archiveUrl}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
responseMsg = await msg.channel.createMessage(successMessage(responseText));
|
responseMsg = await msg.channel.createMessage(successMessage(`<:zep_check:650361014180904971>`, responseText));
|
||||||
} else {
|
} else {
|
||||||
responseMsg = await msg.channel.createMessage(errorMessage(`Found no messages to clean!`));
|
responseMsg = await msg.channel.createMessage(errorMessage(`Found no messages to clean!`));
|
||||||
}
|
}
|
||||||
|
@ -946,7 +946,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.createMessage(successMessage(`The nickname of <@!${args.member.id}> has been reset`));
|
this.sendSuccessMessage(msg.channel, `The nickname of <@!${args.member.id}> has been reset`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("nickname", "<member:resolvedMember> <nickname:string$>", {
|
@d.command("nickname", "<member:resolvedMember> <nickname:string$>", {
|
||||||
|
@ -982,8 +982,9 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(`Changed nickname of <@!${args.member.id}> from **${oldNickname}** to **${args.nickname}**`),
|
msg.channel,
|
||||||
|
`Changed nickname of <@!${args.member.id}> from **${oldNickname}** to **${args.nickname}**`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1236,8 +1237,9 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
newChannel: stripObjectToScalars(channel),
|
newChannel: stripObjectToScalars(channel),
|
||||||
});
|
});
|
||||||
|
|
||||||
msg.channel.createMessage(
|
this.sendSuccessMessage(
|
||||||
successMessage(`**${args.member.user.username}#${args.member.user.discriminator}** moved to **${channel.name}**`),
|
msg.channel,
|
||||||
|
`**${args.member.user.username}#${args.member.user.discriminator}** moved to **${channel.name}**`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,8 +264,8 @@ export function convertMSToDelayString(ms: number): string {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function successMessage(str) {
|
export function successMessage(str, emoji) {
|
||||||
return `<:zep_check:650361014180904971> ${str}`;
|
return `${emoji} ${str}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function errorMessage(str) {
|
export function errorMessage(str) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue