generated from Baipyrus/DiscordJS-Template
simpler/universal bot-user-id access
This commit is contained in:
parent
09f9593a5c
commit
3b1d640612
@ -6,7 +6,7 @@ export const name = Events.MessageCreate;
|
|||||||
/** @param {Message} message */
|
/** @param {Message} message */
|
||||||
export async function execute(message) {
|
export async function execute(message) {
|
||||||
// Ignore direct messages and own messages
|
// Ignore direct messages and own messages
|
||||||
if (!message.inGuild() || message.author.id === process.env.CLIENT) return;
|
if (!message.inGuild() || message.author.id === message.client.user.id) return;
|
||||||
|
|
||||||
// Split message content into words
|
// Split message content into words
|
||||||
const words = message.content
|
const words = message.content
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
import { Events, MessageReaction, User } from 'discord.js';
|
import { Events, MessageReaction, User } from 'discord.js';
|
||||||
import { Messages, RoleEmojiPairs } from '../../database.js';
|
import { Messages, RoleEmojiPairs } from '../../database.js';
|
||||||
import { config } from 'dotenv';
|
|
||||||
|
|
||||||
config();
|
|
||||||
|
|
||||||
export const name = Events.MessageReactionAdd;
|
export const name = Events.MessageReactionAdd;
|
||||||
/**
|
/**
|
||||||
@ -10,7 +7,7 @@ export const name = Events.MessageReactionAdd;
|
|||||||
* @param {User} user
|
* @param {User} user
|
||||||
*/
|
*/
|
||||||
export async function execute(reaction, user) {
|
export async function execute(reaction, user) {
|
||||||
if (user.id === process.env.CLIENT) return;
|
if (user.id === user.client.user.id) return;
|
||||||
|
|
||||||
// Get message
|
// Get message
|
||||||
const msgID = reaction.message.id;
|
const msgID = reaction.message.id;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
import { Events, MessageReaction, User } from 'discord.js';
|
import { Events, MessageReaction, User } from 'discord.js';
|
||||||
import { Messages, RoleEmojiPairs } from '../../database.js';
|
import { Messages, RoleEmojiPairs } from '../../database.js';
|
||||||
import { config } from 'dotenv';
|
|
||||||
|
|
||||||
config();
|
|
||||||
|
|
||||||
export const name = Events.MessageReactionRemove;
|
export const name = Events.MessageReactionRemove;
|
||||||
/**
|
/**
|
||||||
@ -10,7 +7,7 @@ export const name = Events.MessageReactionRemove;
|
|||||||
* @param {User} user
|
* @param {User} user
|
||||||
*/
|
*/
|
||||||
export async function execute(reaction, user) {
|
export async function execute(reaction, user) {
|
||||||
if (user.id === process.env.CLIENT) return;
|
if (user.id === user.client.user.id) return;
|
||||||
|
|
||||||
// Get message
|
// Get message
|
||||||
const msgID = reaction.message.id;
|
const msgID = reaction.message.id;
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
import { ChatInputCommandInteraction, ContextMenuCommandInteraction, Role } from 'discord.js';
|
import { ChatInputCommandInteraction, ContextMenuCommandInteraction, Role } from 'discord.js';
|
||||||
import { Messages, RoleEmojiPairs, Guilds } from './database.js';
|
import { Messages, RoleEmojiPairs, Guilds } from './database.js';
|
||||||
import { readdir } from 'fs/promises';
|
import { readdir } from 'fs/promises';
|
||||||
import { config } from 'dotenv';
|
|
||||||
import { Op } from 'sequelize';
|
import { Op } from 'sequelize';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import Module from 'module';
|
import Module from 'module';
|
||||||
|
|
||||||
config();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main logic of the different 'Self Roles remove' commands to remove the functionality from a `Message`.
|
* Main logic of the different 'Self Roles remove' commands to remove the functionality from a `Message`.
|
||||||
* @param {(ChatInputCommandInteraction|ContextMenuCommandInteraction)} interaction The interaction related to this command.
|
* @param {(ChatInputCommandInteraction|ContextMenuCommandInteraction)} interaction The interaction related to this command.
|
||||||
@ -90,7 +87,7 @@ const saveMessageData = async (id, role, emoji) => {
|
|||||||
* @param {string} emoji Either a unicode emoji or a string representation in Discord custom emoji format.
|
* @param {string} emoji Either a unicode emoji or a string representation in Discord custom emoji format.
|
||||||
*/
|
*/
|
||||||
const editMessage = async (message, role, emoji) => {
|
const editMessage = async (message, role, emoji) => {
|
||||||
if (message.author.id !== process.env.CLIENT) return;
|
if (message.author.id !== message.client.user.id) return;
|
||||||
|
|
||||||
// Find out whether to pad message or already present
|
// Find out whether to pad message or already present
|
||||||
let padding = '\n';
|
let padding = '\n';
|
||||||
|
Loading…
Reference in New Issue
Block a user