1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 04:40:59 -05:00

Compare commits

..

3 Commits

Author SHA1 Message Date
toast-ts
40c7e27b6c Update PostgreSQL image 2024-02-13 17:40:19 +11:00
toast-ts
096d06c9d2 Move server join date from guildMemberRemove to guildBanAdd 2024-02-13 17:29:48 +11:00
toast-ts
a3c623c41a Merge Response calls into one. 2024-02-13 16:44:26 +11:00
6 changed files with 12 additions and 11 deletions

View File

@ -7,7 +7,7 @@ services:
- 6379:6379/tcp - 6379:6379/tcp
db: db:
container_name: postgres-master container_name: postgres-master
image: postgres:16.1-alpine3.19 image: postgres:16.2-alpine3.19
restart: unless-stopped restart: unless-stopped
ports: ports:
- 5432:5432/tcp - 5432:5432/tcp

View File

@ -8,7 +8,7 @@ services:
- 6379:6379/tcp - 6379:6379/tcp
db-slave: db-slave:
container_name: postgres-slave container_name: postgres-slave
image: postgres:16.1-alpine3.19 image: postgres:16.2-alpine3.19
restart: unless-stopped restart: unless-stopped
ports: ports:
- 5432:5432/tcp - 5432:5432/tcp

View File

@ -43,6 +43,7 @@ export default class TClient extends Discord.Client {
public ytChannels: YouTubeChannelsSvc = new YouTubeChannelsSvc(); public ytChannels: YouTubeChannelsSvc = new YouTubeChannelsSvc();
public repeatedMessages: IRepeatedMessages = {}; public repeatedMessages: IRepeatedMessages = {};
public crosspostSpam: ICrosspostSpam = {}; public crosspostSpam: ICrosspostSpam = {};
public memberJoinDates: Map<Discord.Snowflake, string> = new Map();
constructor() { constructor() {
super({ super({

View File

@ -6,14 +6,17 @@ export default class GuildBanAdd {
const banLog = (await member.guild.fetchAuditLogs({ limit: 1, type: Discord.AuditLogEvent.MemberBanAdd })).entries.first(); const banLog = (await member.guild.fetchAuditLogs({ limit: 1, type: Discord.AuditLogEvent.MemberBanAdd })).entries.first();
if (!banLog) return console.log(`Member was banned from ${member.guild.name} but no audit log for this member.`) if (!banLog) return console.log(`Member was banned from ${member.guild.name} but no audit log for this member.`)
const {executor, target, reason } = banLog; const {executor, target, reason } = banLog;
const members_joindate = client.memberJoinDates.get(member.user.id);
if (target.id === member.user.id) { if (target.id === member.user.id) {
const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setThumbnail(member.user.displayAvatarURL({size: 2048})) const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setThumbnail(member.user.displayAvatarURL({size: 2048}))
.setTitle(`Member Banned: ${target.username}`).addFields( .setTitle(`Member Banned: ${target.username}`).addFields(
{name: '🔹 Moderator', value: `<@${executor.id}>\n\`${executor.id}\``}, {name: '🔹 Moderator', value: `<@${executor.id}>\n\`${executor.id}\``},
{name: '🔹 Server Join Date', value: members_joindate ? `<t:${members_joindate}>\n<t:${members_joindate}:R>` : '*Unknown timestamp*'},
{name: '🔹 Reason', value: reason === null ? 'Reason unspecified': reason} {name: '🔹 Reason', value: reason === null ? 'Reason unspecified': reason}
); );
if (!await client.userLevels.fetchUser(member.user.id)) embed.setFooter({text: 'Rank data has been wiped.'}); if (!await client.userLevels.fetchUser(member.user.id)) embed.setFooter({text: 'Rank data has been wiped.'});
(client.channels.resolve(client.config.dcServer.channels.logs) as Discord.TextChannel).send({embeds: [embed]}) (client.channels.resolve(client.config.dcServer.channels.logs) as Discord.TextChannel).send({embeds: [embed]});
client.memberJoinDates.delete(member.user.id);
} else console.log(`User was banned from "${member.guild.name}" but no audit log could be fetched.`) } else console.log(`User was banned from "${member.guild.name}" but no audit log could be fetched.`)
} }
} }

View File

@ -4,10 +4,8 @@ export default class GuildMemberRemove {
static async run(client:TClient, member:Discord.GuildMember) { static async run(client:TClient, member:Discord.GuildMember) {
if (!client.config.botSwitches.logs) return; if (!client.config.botSwitches.logs) return;
if (!member.joinedTimestamp || member.guild?.id != client.config.dcServer.id) return; if (!member.joinedTimestamp || member.guild?.id != client.config.dcServer.id) return;
if (client.guilds.cache.get(client.config.dcServer.id).bans.cache.has(member.id)) { client.memberJoinDates.set(member.user.id, `${Math.round(member.joinedTimestamp/1000)}`);
(client.channels.resolve(client.config.dcServer.channels.logs) as Discord.TextChannel).send(`**${member.user.username}**'s join date is <t:${Math.round(member.joinedTimestamp/1000)}>`) if (client.guilds.cache.get(client.config.dcServer.id).bans.cache.has(member.id)) return await client.userLevels.deleteUser(member.id);
return await client.userLevels.deleteUser(member.id);
};
let isBot = 'Bot'; let isBot = 'Bot';
if (!member.user.bot) isBot = 'Member'; if (!member.user.bot) isBot = 'Member';
const levelData = await client.userLevels.fetchUser(member.id); const levelData = await client.userLevels.fetchUser(member.id);

View File

@ -76,10 +76,9 @@ export default class MessageCreate {
guildBoost: ['Thanks for boosting our server!', 'Thanks for the boost!', 'We appreciate the boost!', `Thank you for the kind boost, <@${message.author.id}>!`], guildBoost: ['Thanks for boosting our server!', 'Thanks for the boost!', 'We appreciate the boost!', `Thank you for the kind boost, <@${message.author.id}>!`],
} }
const GeneralChatID = ConfigHelper.isDevMode() ? '929807948748832801' : '468835415093411863'; const GeneralChatID = ConfigHelper.isDevMode() ? '929807948748832801' : '468835415093411863';
Response.create(message, GeneralChatID, 'morning');
Response.create(message, GeneralChatID, 'afternoon'); const times_of_day = ['morning', 'afternoon', 'evening', 'night'];
Response.create(message, GeneralChatID, 'evening'); for (let i = 0; i < times_of_day.length; i++) Response.create(message, GeneralChatID, times_of_day[i]);
Response.create(message, GeneralChatID, 'night');
CmdTrigger.registerCmds(client, message, 'register'); CmdTrigger.registerCmds(client, message, 'register');
CmdTrigger.MFPwTrigger(message, 'farmpw'); CmdTrigger.MFPwTrigger(message, 'farmpw');