1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 08:20:58 -05:00

more improvements

This commit is contained in:
AnxietyisReal 2022-11-19 22:50:46 +11:00
parent 158783e514
commit 2d2b99e0e2
8 changed files with 27 additions and 17 deletions

View File

@ -1,9 +1,6 @@
interface UserLevels {
messages: number,
level: number
}
import Discord,{SlashCommandBuilder} from 'discord.js';
import { TClient } from 'src/client';
import { UserLevels } from 'src/typings/interfaces';
export default {
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
if (interaction.guildId !== client.config.mainServer.id) return interaction.reply({content: 'This command doesn\'t work in this server.', ephemeral: true});
@ -152,7 +149,7 @@ export default {
// fetch user or user interaction sender
const member = interaction.options.getMember("member") ?? interaction.member as Discord.GuildMember;
if (member.user.bot) return interaction.reply('Bots don\'t level up, try viewing non-bots instead.')
const embed = new client.embed().setColor(member.displayColor)
// information about users progress on level roles
@ -182,7 +179,7 @@ export default {
.setDescription('Level system')
.addSubcommand((optt)=>optt
.setName('view')
.setDescription('View your rank, someone else\'s rank')
.setDescription('View your rank or someone else\'s rank')
.addUserOption((opt)=>opt
.setName('member')
.setDescription('Which member do you want to view?')))

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"190407856527376384": 7,
"711527768185372742": 1,
"716355511552966737": 5,
"593696856165449749": 14,
"593696856165449749": 15,
"824043915539513406": 20,
"771892617599516674": 10,
"889665445915926588": 1,
@ -24,5 +24,6 @@
"506022868157595648": 1,
"468837263577579524": 3,
"743212818467258468": 1,
"954092707213619221": 1
"954092707213619221": 1,
"292726506654793730": 1
}

View File

@ -1 +1 @@
[[0,674965],[1,675885],[2,676639],[3,677245],[4,677609],[5,678188],[6,678916],[7,679465],[8,679938],[9,680540],[10,681614],[11,682079],[12,682780],[13,683187],[14,683547],[15,683900],[16,684592],[17,685466],[18,686078],[19,686481],[20,676748],[21,676968],[22,677427],[23,677592],[24,677894],[25,678116],[26,676785],[27,677570],[28,678491],[29,679137],[30,679818],[31,680094],[32,680417],[33,680783],[34,681563],[35,682070],[36,682670],[37,683504],[38,684078],[39,684383],[40,684692],[41,685448],[42,685664],[43,685994],[44,686366],[45,687118],[46,687626],[47,688008],[48,688754],[49,688942],[50,689107],[51,689472],[52,690143],[53,690644],[54,691124],[55,692196],[56,692624],[57,692906],[58,693456],[59,693952],[60,694586],[61,695070],[62,696163],[63,696564],[64,697315],[65,698548],[66,699138],[67,699558],[68,700307],[69,701063],[70,701394],[71,701868],[72,702453],[73,702917],[76,705187],[77,705243],[78,705488],[79,705961],[80,706585],[81,707467],[82,708212],[83,709024],[84,709773],[85,710256],[86,710980],[87,711220]]
[[0,674965],[1,675885],[2,676639],[3,677245],[4,677609],[5,678188],[6,678916],[7,679465],[8,679938],[9,680540],[10,681614],[11,682079],[12,682780],[13,683187],[14,683547],[15,683900],[16,684592],[17,685466],[18,686078],[19,686481],[20,676748],[21,676968],[22,677427],[23,677592],[24,677894],[25,678116],[26,676785],[27,677570],[28,678491],[29,679137],[30,679818],[31,680094],[32,680417],[33,680783],[34,681563],[35,682070],[36,682670],[37,683504],[38,684078],[39,684383],[40,684692],[41,685448],[42,685664],[43,685994],[44,686366],[45,687118],[46,687626],[47,688008],[48,688754],[49,688942],[50,689107],[51,689472],[52,690143],[53,690644],[54,691124],[55,692196],[56,692624],[57,692906],[58,693456],[59,693952],[60,694586],[61,695070],[62,696163],[63,696564],[64,697315],[65,698548],[66,699138],[67,699558],[68,700307],[69,701063],[70,701394],[71,701868],[72,702453],[73,702917],[76,705187],[77,705243],[78,705488],[79,705961],[80,706585],[81,707467],[82,708212],[83,709024],[84,709773],[85,710256],[86,710980],[87,711220],[88,711428]]

View File

@ -102,5 +102,13 @@
"moderator": "141304507249197057",
"time": 1668526989338,
"reason": "steam scammer"
},
{
"type": "ban",
"id": 14,
"member": "1041929757916405791",
"moderator": "593696856165449749",
"time": 1668851141637,
"reason": "Steam scammer"
}
]

View File

@ -1,6 +1,6 @@
{
"190407856527376384": {
"messages": 53029,
"messages": 53030,
"level": 59
},
"593696856165449749": {
@ -2802,5 +2802,9 @@
"981739292965634189": {
"messages": 3,
"level": 0
},
"923275627136700457": {
"messages": 1,
"level": 0
}
}

View File

@ -4,7 +4,7 @@ const client = new TClient;
client.init();
import fs from 'node:fs';
import MPDB from './models/MPServer';
import { Punishment, punOpt } from './typings/interfaces';
import { Punishment, punOpt, UserLevels } from './typings/interfaces';
client.on('ready', async()=>{
client.guilds.cache.forEach(async(e: { members: { fetch: () => any; }; })=>{await e.members.fetch()});
@ -23,7 +23,7 @@ client.on('ready', async()=>{
}, 500000);
console.log(`${client.user.tag} has logged into Discord API and now ready for operation`);
console.log(client.config.botSwitches);
//(client.channels.resolve(client.config.mainServer.channels.bot_status) as Discord.TextChannel).send(`${client.user.username} is active\n\`\`\`json\n${Object.entries(client.config.botSwitches).map((hi)=>`${hi[0]}: ${hi[1]}`).join('\n')}\`\`\``);
(client.channels.resolve(client.config.mainServer.channels.bot_status) as Discord.TextChannel).send(`${client.user.username} is active\n\`\`\`json\n${Object.entries(client.config.botSwitches).map((hi)=>`${hi[0]}: ${hi[1]}`).join('\n')}\`\`\``);
// Event handler
const eventFiles = fs.readdirSync('src/events').filter(file=>file.endsWith('.ts'));
@ -152,10 +152,6 @@ setInterval(async()=>{
const formattedDate = Math.floor((now - lrsStart)/1000/60/60/24);
const dailyMsgs = require('./database/dailyMsgs.json');
interface UserLevels {
messages: number,
level: number
}
if (!dailyMsgs.some(x=>x[0] === formattedDate)){
let total = Object.values<UserLevels>(client.userLevels._content).reduce((a,b)=>a + b.messages, 0); // sum of all users
const yesterday = dailyMsgs.find((x:Array<number>)=>x[0] === formattedDate - 1);

View File

@ -1,3 +1,7 @@
export interface UserLevels {
messages: number,
level: number
}
export interface formatTimeOpt {
longNames: boolean,
commas: boolean