mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 04:40:59 -05:00
Compare commits
3 Commits
c91962b357
...
8b27bff2a7
Author | SHA1 | Date | |
---|---|---|---|
|
8b27bff2a7 | ||
|
5d2c8a048c | ||
|
f6d4b255f0 |
@ -29,8 +29,10 @@ export default class CanvasBuilder {
|
|||||||
const origin = [15, 65];
|
const origin = [15, 65];
|
||||||
const size = [1300, 630];
|
const size = [1300, 630];
|
||||||
const nodeWidth = size[0] / (data.length - 1);
|
const nodeWidth = size[0] / (data.length - 1);
|
||||||
|
this.ctx.globalAlpha = 0;
|
||||||
this.ctx.fillStyle = this.palette.background;
|
this.ctx.fillStyle = this.palette.background;
|
||||||
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
||||||
|
this.ctx.globalAlpha = 1;
|
||||||
|
|
||||||
// Grey horizontal lines
|
// Grey horizontal lines
|
||||||
this.ctx.lineWidth = 5;
|
this.ctx.lineWidth = 5;
|
||||||
|
@ -3,35 +3,24 @@ import TClient from '../client.js';
|
|||||||
export default class GuildMemberAdd {
|
export default class GuildMemberAdd {
|
||||||
static async run(client:TClient, member:Discord.GuildMember){
|
static async run(client:TClient, member:Discord.GuildMember){
|
||||||
if (member.partial || member.guild?.id != client.config.dcServer.id) return;
|
if (member.partial || member.guild?.id != client.config.dcServer.id) return;
|
||||||
const index = member.guild.memberCount;
|
const memberCount = member.guild.memberCount;
|
||||||
/* const suffix = (index=>{
|
const suffix = {
|
||||||
const numbers = index.toString().split('').reverse(); // eg 1850 --> [0,5,8,1]
|
|
||||||
if (numbers[1] === '1') return 'th'; // this is some -teen
|
|
||||||
else {
|
|
||||||
if (numbers[0] === '1') return 'st';
|
|
||||||
else if (numbers[0] === '2') return 'nd';
|
|
||||||
else if (numbers[0] === '3') return 'rd';
|
|
||||||
else return 'th';
|
|
||||||
}
|
|
||||||
})(index); */
|
|
||||||
|
|
||||||
const suffix = {// Trial run, just discovered Intl.PluralRules this morning (as of March 24th) when I was browsing MDN Docs.
|
|
||||||
one: 'st',
|
one: 'st',
|
||||||
two: 'nd',
|
two: 'nd',
|
||||||
few: 'rd',
|
few: 'rd',
|
||||||
other: 'th'
|
other: 'th'
|
||||||
}[new Intl.PluralRules('en', {type: 'ordinal'}).select(index)];
|
}[new Intl.PluralRules('en', {type: 'ordinal'}).select(memberCount)];
|
||||||
|
|
||||||
let isBot = 'Bot';
|
let isBot = 'Bot';
|
||||||
if (!member.user.bot) isBot = 'Member';
|
if (!member.user.bot) isBot = 'Member';
|
||||||
if (!client.config.botSwitches.logs) return;
|
if (!client.config.botSwitches.logs) return;
|
||||||
(client.channels.resolve(client.config.dcServer.channels.welcome) as Discord.TextChannel).send({embeds: [new client.embed().setColor(client.config.embedColor).setThumbnail(member.user.displayAvatarURL({size: 2048}) || member.user.defaultAvatarURL).setTitle(`Welcome to ${member.guild.name}, ${member.user.username}!`).setFooter({text: `${index}${suffix} member`})]});
|
(client.channels.resolve(client.config.dcServer.channels.welcome) as Discord.TextChannel).send({embeds: [new client.embed().setColor(client.config.embedColor).setThumbnail(member.user.displayAvatarURL({size: 2048}) || member.user.defaultAvatarURL).setTitle(`Welcome to ${member.guild.name}, ${member.user.username}!`).setFooter({text: `${memberCount}${suffix} member`})]});
|
||||||
|
|
||||||
const newInvites = await member.guild.invites.fetch();
|
const newInvites = await member.guild.invites.fetch();
|
||||||
const usedInvite = newInvites.find((inv:Discord.Invite)=>client.invites.get(inv.code)?.uses < inv.uses);
|
const usedInvite = newInvites.find((inv:Discord.Invite)=>client.invites.get(inv.code)?.uses < inv.uses);
|
||||||
newInvites.forEach((inv:Discord.Invite)=>client.invites.set(inv.code,{uses: inv.uses, creator: inv.inviterId, channel: inv.channel.name}));
|
newInvites.forEach((inv:Discord.Invite)=>client.invites.set(inv.code,{uses: inv.uses, creator: inv.inviterId, channel: inv.channel.name}));
|
||||||
(client.channels.resolve(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({embeds: [
|
(client.channels.resolve(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({embeds: [
|
||||||
new client.embed().setColor(client.config.embedColorGreen).setTimestamp().setThumbnail(member.user.displayAvatarURL({size: 2048})).setTitle(`${isBot} Joined: ${member.user.username}`).setFooter({text: `Total members: ${index}${suffix} | ID: ${member.user.id}`}).addFields(
|
new client.embed().setColor(client.config.embedColorGreen).setTimestamp().setThumbnail(member.user.displayAvatarURL({size: 2048})).setTitle(`${isBot} Joined: ${member.user.username}`).setFooter({text: `Total members: ${memberCount}${suffix} | ID: ${member.user.id}`}).addFields(
|
||||||
{name: '🔹 Account Creation Date', value: `<t:${Math.round(member.user.createdTimestamp/1000)}>\n<t:${Math.round(member.user.createdTimestamp/1000)}:R>`},
|
{name: '🔹 Account Creation Date', value: `<t:${Math.round(member.user.createdTimestamp/1000)}>\n<t:${Math.round(member.user.createdTimestamp/1000)}:R>`},
|
||||||
{name: '🔹 Invite Data:', value: usedInvite ? `Invite: \`${usedInvite.code}\`\nCreated by: **${usedInvite.inviter?.username}**\nChannel: **#${usedInvite.channel.name}**` : 'No invite data could be fetched.'}
|
{name: '🔹 Invite Data:', value: usedInvite ? `Invite: \`${usedInvite.code}\`\nCreated by: **${usedInvite.inviter?.username}**\nChannel: **#${usedInvite.channel.name}**` : 'No invite data could be fetched.'}
|
||||||
)]});
|
)]});
|
||||||
|
Loading…
Reference in New Issue
Block a user