mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-07 16:05:01 +00:00
Added Discord attachment link reaction, fixed emoji configuration and moved util functions
This commit is contained in:
parent
a4c4b17a14
commit
592d037148
173 changed files with 1540 additions and 1170 deletions
|
@ -1,10 +1,10 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { getChannelId, getRoleId } from "knub/helpers";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage } from "../../../pluginUtils";
|
||||
import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils";
|
||||
import { canReadChannel } from "../../../utils/canReadChannel";
|
||||
import { resolveMessageTarget } from "../../../utils/resolveMessageTarget";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed";
|
||||
import { getCustomEmojiId } from "../functions/getCustomEmojiId";
|
||||
import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed";
|
||||
|
@ -42,7 +42,7 @@ export const InfoCmd = utilityCmd({
|
|||
const channelId = getChannelId(value);
|
||||
const channel = channelId && pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (channel) {
|
||||
const embed = await getChannelInfoEmbed(pluginData, channelId!, message.author.id);
|
||||
const embed = await getChannelInfoEmbed(pluginData, channelId!);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -54,7 +54,7 @@ export const InfoCmd = utilityCmd({
|
|||
if (userCfg.can_server) {
|
||||
const guild = await pluginData.client.guilds.fetch(value as Snowflake).catch(noop);
|
||||
if (guild) {
|
||||
const embed = await getServerInfoEmbed(pluginData, value, message.author.id);
|
||||
const embed = await getServerInfoEmbed(pluginData, value);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -66,7 +66,7 @@ export const InfoCmd = utilityCmd({
|
|||
if (userCfg.can_userinfo) {
|
||||
const user = await resolveUser(pluginData.client, value);
|
||||
if (user && userCfg.can_userinfo) {
|
||||
const embed = await getUserInfoEmbed(pluginData, user.id, Boolean(args.compact), message.author.id);
|
||||
const embed = await getUserInfoEmbed(pluginData, user.id, Boolean(args.compact));
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -79,12 +79,7 @@ export const InfoCmd = utilityCmd({
|
|||
const messageTarget = await resolveMessageTarget(pluginData, value);
|
||||
if (messageTarget) {
|
||||
if (canReadChannel(messageTarget.channel, message.member)) {
|
||||
const embed = await getMessageInfoEmbed(
|
||||
pluginData,
|
||||
messageTarget.channel.id,
|
||||
messageTarget.messageId,
|
||||
message.author.id,
|
||||
);
|
||||
const embed = await getMessageInfoEmbed(pluginData, messageTarget.channel.id, messageTarget.messageId);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -112,7 +107,7 @@ export const InfoCmd = utilityCmd({
|
|||
if (userCfg.can_server) {
|
||||
const serverPreview = await getGuildPreview(pluginData.client, value).catch(() => null);
|
||||
if (serverPreview) {
|
||||
const embed = await getServerInfoEmbed(pluginData, value, message.author.id);
|
||||
const embed = await getServerInfoEmbed(pluginData, value);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -125,7 +120,7 @@ export const InfoCmd = utilityCmd({
|
|||
const roleId = getRoleId(value);
|
||||
const role = roleId && pluginData.guild.roles.cache.get(roleId as Snowflake);
|
||||
if (role) {
|
||||
const embed = await getRoleInfoEmbed(pluginData, role, message.author.id);
|
||||
const embed = await getRoleInfoEmbed(pluginData, role);
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
}
|
||||
|
@ -145,16 +140,17 @@ export const InfoCmd = utilityCmd({
|
|||
|
||||
// 9. Arbitrary ID
|
||||
if (isValidSnowflake(value) && userCfg.can_snowflake) {
|
||||
const embed = await getSnowflakeInfoEmbed(pluginData, value, true, message.author.id);
|
||||
const embed = await getSnowflakeInfoEmbed(value, true);
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
}
|
||||
|
||||
// 10. No can do
|
||||
sendErrorMessage(
|
||||
pluginData,
|
||||
message.channel,
|
||||
"Could not find anything with that value or you are lacking permission for the snowflake type",
|
||||
);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(
|
||||
message,
|
||||
"Could not find anything with that value or you are lacking permission for the snowflake type",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue