added direct message retrieval
This commit is contained in:
parent
5ce1841cba
commit
03a7851605
1 changed files with 24 additions and 6 deletions
30
src/index.js
30
src/index.js
|
@ -1,20 +1,22 @@
|
|||
require("dotenv").config();
|
||||
const {
|
||||
Client,
|
||||
IntentsBitField,
|
||||
EmbedBuilder,
|
||||
Collection,
|
||||
GatewayIntentBits,
|
||||
Partials,
|
||||
} = require("discord.js");
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
IntentsBitField.Flags.Guilds,
|
||||
IntentsBitField.Flags.GuildMembers,
|
||||
IntentsBitField.Flags.GuildMessages,
|
||||
IntentsBitField.Flags.MessageContent,
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
],
|
||||
partials: [Partials.Message, Partials.Channel],
|
||||
});
|
||||
|
||||
client.commands = new Collection();
|
||||
|
@ -36,6 +38,7 @@ client.on("ready", (c) => {
|
|||
const channel = client.channels.cache.get("1148814162273763418");
|
||||
channel.send("pepperbot restart complete");
|
||||
});
|
||||
|
||||
client.on("guildMemberAdd", (member) => {
|
||||
if (member.guild.id === "1112819622505365556") {
|
||||
fs.appendFileSync(
|
||||
|
@ -84,6 +87,21 @@ client.on("messageDelete", async (message) => {
|
|||
});
|
||||
|
||||
client.on("messageCreate", async (message) => {
|
||||
if (message.channel.type === 1) {
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/directmessages.log",
|
||||
"direct message from: " +
|
||||
message.author.username +
|
||||
"(" +
|
||||
message.author +
|
||||
") at " +
|
||||
Date() +
|
||||
' with: "' +
|
||||
message.content +
|
||||
'"\n'
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!message.content.startsWith(prefix)) return;
|
||||
const args = message.content.slice(prefix.length).split(/ +/);
|
||||
const command = args.shift().toLowerCase();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue