add support for DMs
This commit is contained in:
parent
5a7d5f3467
commit
830458d5d2
3 changed files with 25 additions and 12 deletions
|
@ -2,6 +2,8 @@ export const GUILD_ID = '923671181020766230';
|
||||||
export const DEBUG_CHANNEL_ID = '977401259260788756';
|
export const DEBUG_CHANNEL_ID = '977401259260788756';
|
||||||
export const POLYCAT_CHANNEL_ID = '977797790749032448';
|
export const POLYCAT_CHANNEL_ID = '977797790749032448';
|
||||||
|
|
||||||
|
export const DM_TESTERS = ['952235800110694471'];
|
||||||
|
|
||||||
export const ETA_REGEX = /\beta\b/i;
|
export const ETA_REGEX = /\beta\b/i;
|
||||||
export const ETA_MESSAGES = [
|
export const ETA_MESSAGES = [
|
||||||
'Sometime',
|
'Sometime',
|
||||||
|
|
33
src/index.ts
33
src/index.ts
|
@ -1,4 +1,12 @@
|
||||||
import { Client, Message, EmbedBuilder, type EmbedData } from 'discord.js';
|
import {
|
||||||
|
Client,
|
||||||
|
Message,
|
||||||
|
EmbedBuilder,
|
||||||
|
type EmbedData,
|
||||||
|
GatewayIntentBits,
|
||||||
|
Partials,
|
||||||
|
ChannelType,
|
||||||
|
} from 'discord.js';
|
||||||
|
|
||||||
import * as BuildConfig from './constants';
|
import * as BuildConfig from './constants';
|
||||||
import { commands } from './commands';
|
import { commands } from './commands';
|
||||||
|
@ -51,15 +59,16 @@ export const getTags = async (): Promise<Tag[]> => {
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [
|
intents: [
|
||||||
'Guilds',
|
GatewayIntentBits.Guilds,
|
||||||
'GuildMessages',
|
GatewayIntentBits.GuildMessages,
|
||||||
'MessageContent',
|
GatewayIntentBits.MessageContent,
|
||||||
'DirectMessages',
|
GatewayIntentBits.DirectMessages,
|
||||||
'GuildMembers',
|
GatewayIntentBits.GuildMembers,
|
||||||
'GuildPresences',
|
GatewayIntentBits.GuildPresences,
|
||||||
'GuildMessageReactions',
|
GatewayIntentBits.GuildMessageReactions,
|
||||||
'GuildBans',
|
GatewayIntentBits.GuildBans,
|
||||||
],
|
],
|
||||||
|
partials: [Partials.Channel],
|
||||||
});
|
});
|
||||||
|
|
||||||
client.once('ready', async () => {
|
client.once('ready', async () => {
|
||||||
|
@ -80,7 +89,9 @@ client.once('ready', async () => {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
process.env.NODE_ENV === 'development' &&
|
process.env.NODE_ENV === 'development' &&
|
||||||
e.channelId !== BuildConfig.DEBUG_CHANNEL_ID
|
e.channelId !== BuildConfig.DEBUG_CHANNEL_ID &&
|
||||||
|
e.channel.type === ChannelType.DM &&
|
||||||
|
!BuildConfig.DM_TESTERS.includes(e.author.id)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
} else if (
|
} else if (
|
||||||
|
@ -152,7 +163,7 @@ async function parseMsgForTags(e: Message) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tag) {
|
if (tag) {
|
||||||
const requesterAvatarURL = e.author.avatar;
|
const requesterAvatarURL = e.author.avatarURL();
|
||||||
const tagRequester = {
|
const tagRequester = {
|
||||||
text: `Requested by ${e.author.tag}`,
|
text: `Requested by ${e.author.tag}`,
|
||||||
...(requesterAvatarURL ? { icon_url: requesterAvatarURL } : null),
|
...(requesterAvatarURL ? { icon_url: requesterAvatarURL } : null),
|
||||||
|
|
|
@ -230,7 +230,7 @@ export async function parseLog(s: string): Promise<EmbedBuilder | null> {
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('pastebin.com detected')
|
.setTitle('pastebin.com detected')
|
||||||
.setDescription(
|
.setDescription(
|
||||||
'Please use https://mclo.gs or another paste provider and send logs using the Log Upload feature in PolyMC. (See !log)'
|
'Please use https://mclo.gs or another paste provider and send logs using the Log Upload feature in PolyMC. (See ?log)'
|
||||||
)
|
)
|
||||||
.setColor(COLORS.red);
|
.setColor(COLORS.red);
|
||||||
return embed;
|
return embed;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue