mirror of
https://github.com/nx-bat/discordbot-ng.git
synced 2026-11-11 07:13:37 -05:00
Fix line endings
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, ModalBuilder, PermissionFlagsBits, TextInputStyle, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { createTextInput } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Add Note',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Add Note')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
const member = await interaction.guild?.members.fetch(idToUse);
|
||||
|
||||
const modal = new ModalBuilder()
|
||||
.setCustomId(`add-note-modal_${idToUse}`)
|
||||
.setTitle(`Adding note to ${member ? member.displayName : idToUse}`);
|
||||
|
||||
const inputLabel = createTextInput('note-message', 'Note Message', null, true, TextInputStyle.Paragraph, 1500, 2);
|
||||
|
||||
modal.addLabelComponents(inputLabel);
|
||||
|
||||
await interaction.showModal(modal);
|
||||
}
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, ModalBuilder, PermissionFlagsBits, TextInputStyle, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { createTextInput } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Add Note',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Add Note')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
const member = await interaction.guild?.members.fetch(idToUse);
|
||||
|
||||
const modal = new ModalBuilder()
|
||||
.setCustomId(`add-note-modal_${idToUse}`)
|
||||
.setTitle(`Adding note to ${member ? member.displayName : idToUse}`);
|
||||
|
||||
const inputLabel = createTextInput('note-message', 'Note Message', null, true, TextInputStyle.Paragraph, 1500, 2);
|
||||
|
||||
modal.addLabelComponents(inputLabel);
|
||||
|
||||
await interaction.showModal(modal);
|
||||
}
|
||||
};
|
||||
@@ -1,23 +1,23 @@
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, PermissionFlagsBits, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { deferInteraction, getNoteMessage } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'List Notes',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('List Notes')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
await deferInteraction(interaction);
|
||||
|
||||
const noteMessage = await getNoteMessage(idToUse, 1);
|
||||
|
||||
if (!noteMessage) return interaction.editReply(`No notes found for <@${idToUse}>`);
|
||||
|
||||
interaction.editReply(noteMessage);
|
||||
}
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, PermissionFlagsBits, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { deferInteraction, getNoteMessage } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'List Notes',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('List Notes')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
await deferInteraction(interaction);
|
||||
|
||||
const noteMessage = await getNoteMessage(idToUse, 1);
|
||||
|
||||
if (!noteMessage) return interaction.editReply(`No notes found for <@${idToUse}>`);
|
||||
|
||||
interaction.editReply(noteMessage);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +1,19 @@
|
||||
import { ApplicationIntegrationType, Client, InteractionContextType, PermissionFlagsBits, ContextMenuCommandBuilder, ApplicationCommandType, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { openModTicketModal } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Open Mod Ticket',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Open Mod Ticket')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const member = await interaction.guild?.members.fetch(interaction.targetUser.id);
|
||||
|
||||
if (!member) return interaction.editReply('Could not find member.');
|
||||
|
||||
openModTicketModal(interaction, member);
|
||||
}
|
||||
import { ApplicationIntegrationType, Client, InteractionContextType, PermissionFlagsBits, ContextMenuCommandBuilder, ApplicationCommandType, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { openModTicketModal } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Open Mod Ticket',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Open Mod Ticket')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const member = await interaction.guild?.members.fetch(interaction.targetUser.id);
|
||||
|
||||
if (!member) return interaction.editReply('Could not find member.');
|
||||
|
||||
openModTicketModal(interaction, member);
|
||||
}
|
||||
};
|
||||
@@ -1,23 +1,23 @@
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, PermissionFlagsBits, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { deferInteraction, getRecordMessageFromDiscordId } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Get Records',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Get Records')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
await deferInteraction(interaction);
|
||||
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
const recordMessage = await getRecordMessageFromDiscordId(idToUse, 1, interaction.guild!);
|
||||
|
||||
if (!recordMessage) return interaction.editReply('No records found on any linked accounts.');
|
||||
|
||||
interaction.editReply(recordMessage);
|
||||
}
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, PermissionFlagsBits, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { deferInteraction, getRecordMessageFromDiscordId } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Get Records',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Get Records')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
await deferInteraction(interaction);
|
||||
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
const recordMessage = await getRecordMessageFromDiscordId(idToUse, 1, interaction.guild!);
|
||||
|
||||
if (!recordMessage) return interaction.editReply('No records found on any linked accounts.');
|
||||
|
||||
interaction.editReply(recordMessage);
|
||||
}
|
||||
};
|
||||
@@ -1,57 +1,57 @@
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, ModalBuilder, PermissionFlagsBits, TextInputStyle, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { config } from '../config';
|
||||
import { Database } from '../shared/Database';
|
||||
import { createTextInput, deferInteraction, syncName } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Sync Name',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Sync Name')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const availableIds = await Database.getE621Ids(interaction.user.id);
|
||||
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(config.DISCORD_GUILD_ID!);
|
||||
|
||||
if (!guild) {
|
||||
return interaction.editReply('An error has occurred. Please try again later.');
|
||||
}
|
||||
|
||||
const member = await guild.members.fetch(idToUse);
|
||||
|
||||
const interactionMember = await guild.members.fetch(interaction.user.id);
|
||||
|
||||
if (!member || !interactionMember) {
|
||||
return interaction.reply('An error has occurred. Please try again later.');
|
||||
}
|
||||
|
||||
if (interactionMember.roles.highest.comparePositionTo(member.roles.highest) <= 0) {
|
||||
return await interaction.editReply("You do not have permission to sync this user's name.");
|
||||
}
|
||||
|
||||
if (availableIds.length > 1) {
|
||||
const modal = new ModalBuilder()
|
||||
.setCustomId(`sync-name-modal_${idToUse}`)
|
||||
.setTitle(`Syncing ${member ? member.displayName : idToUse}'s name`);
|
||||
|
||||
const inputLabel = createTextInput('id', 'User has multiple linked accounts. Provide ID', null, false, TextInputStyle.Short, null, null);
|
||||
|
||||
modal.addLabelComponents(inputLabel);
|
||||
|
||||
return await interaction.showModal(modal);
|
||||
}
|
||||
|
||||
await deferInteraction(interaction);
|
||||
|
||||
if (!guild.members.me) {
|
||||
return interaction.editReply('An error has occurred. Please try again later.');
|
||||
}
|
||||
|
||||
await syncName(interaction, member, null);
|
||||
}
|
||||
import { ApplicationCommandType, ApplicationIntegrationType, Client, ContextMenuCommandBuilder, InteractionContextType, ModalBuilder, PermissionFlagsBits, TextInputStyle, UserContextMenuCommandInteraction } from 'discord.js';
|
||||
import { config } from '../config';
|
||||
import { Database } from '../shared/Database';
|
||||
import { createTextInput, deferInteraction, syncName } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Sync Name',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Sync Name')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const availableIds = await Database.getE621Ids(interaction.user.id);
|
||||
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(config.DISCORD_GUILD_ID!);
|
||||
|
||||
if (!guild) {
|
||||
return interaction.editReply('An error has occurred. Please try again later.');
|
||||
}
|
||||
|
||||
const member = await guild.members.fetch(idToUse);
|
||||
|
||||
const interactionMember = await guild.members.fetch(interaction.user.id);
|
||||
|
||||
if (!member || !interactionMember) {
|
||||
return interaction.reply('An error has occurred. Please try again later.');
|
||||
}
|
||||
|
||||
if (interactionMember.roles.highest.comparePositionTo(member.roles.highest) <= 0) {
|
||||
return await interaction.editReply("You do not have permission to sync this user's name.");
|
||||
}
|
||||
|
||||
if (availableIds.length > 1) {
|
||||
const modal = new ModalBuilder()
|
||||
.setCustomId(`sync-name-modal_${idToUse}`)
|
||||
.setTitle(`Syncing ${member ? member.displayName : idToUse}'s name`);
|
||||
|
||||
const inputLabel = createTextInput('id', 'User has multiple linked accounts. Provide ID', null, false, TextInputStyle.Short, null, null);
|
||||
|
||||
modal.addLabelComponents(inputLabel);
|
||||
|
||||
return await interaction.showModal(modal);
|
||||
}
|
||||
|
||||
await deferInteraction(interaction);
|
||||
|
||||
if (!guild.members.me) {
|
||||
return interaction.editReply('An error has occurred. Please try again later.');
|
||||
}
|
||||
|
||||
await syncName(interaction, member, null);
|
||||
}
|
||||
};
|
||||
+16
-16
@@ -1,17 +1,17 @@
|
||||
import { ApplicationIntegrationType, Client, InteractionContextType, PermissionFlagsBits, ContextMenuCommandBuilder, ApplicationCommandType, UserContextMenuCommandInteraction, GuildBasedChannel } from 'discord.js';
|
||||
import { channelIsInStaffCategory, handleWhoIsInteraction } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Whois',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Whois')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
handleWhoIsInteraction(interaction, idToUse, !(await channelIsInStaffCategory(interaction.channel as GuildBasedChannel)));
|
||||
}
|
||||
import { ApplicationIntegrationType, Client, InteractionContextType, PermissionFlagsBits, ContextMenuCommandBuilder, ApplicationCommandType, UserContextMenuCommandInteraction, GuildBasedChannel } from 'discord.js';
|
||||
import { channelIsInStaffCategory, handleWhoIsInteraction } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'Whois',
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName('Whois')
|
||||
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall)
|
||||
.setContexts(InteractionContextType.Guild)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setType(ApplicationCommandType.User),
|
||||
handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) {
|
||||
const idToUse = interaction.targetUser.id;
|
||||
|
||||
handleWhoIsInteraction(interaction, idToUse, !(await channelIsInStaffCategory(interaction.channel as GuildBasedChannel)));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user