mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 20:30:58 -05:00
Compare commits
No commits in common. "c88c252d991e0dc79ea383534afe7a4c508c05cd" and "d434507b9b42857635961903f307415f9d0bc4dd" have entirely different histories.
c88c252d99
...
d434507b9b
4
.github/workflows/combine-dependabot-prs.yml
vendored
4
.github/workflows/combine-dependabot-prs.yml
vendored
@ -116,7 +116,7 @@ jobs:
|
|||||||
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
|
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let combinedPRs = [];
|
let combinedPRs = [];
|
||||||
let mergeFailedPRs = [];
|
let mergeFailedPRs = [];
|
||||||
for(const { branch, prString } of branchesAndPRStrings) {
|
for(const { branch, prString } of branchesAndPRStrings) {
|
||||||
@ -134,7 +134,7 @@ jobs:
|
|||||||
mergeFailedPRs.push(prString);
|
mergeFailedPRs.push(prString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Creating combined PR');
|
console.log('Creating combined PR');
|
||||||
const combinedPRsString = combinedPRs.join('\n');
|
const combinedPRsString = combinedPRs.join('\n');
|
||||||
let body = '✅ This PR was created by the Combine Dependabot PRs action by combining the following PRs:\n' + combinedPRsString;
|
let body = '✅ This PR was created by the Combine Dependabot PRs action by combining the following PRs:\n' + combinedPRsString;
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
.env
|
|
||||||
# Yarn stuff
|
# Yarn stuff
|
||||||
.yarn
|
.yarn
|
||||||
# TypeScript stuff
|
# TypeScript stuff
|
||||||
|
@ -7,7 +7,7 @@ This is a repository for V3 revision that has been transitioned and rewritten fr
|
|||||||
|
|
||||||
This revision took **4 months** (Late September to Mid December) working on and off to do literally everything that needed a rewrite so badly that it cannot be done in V2.
|
This revision took **4 months** (Late September to Mid December) working on and off to do literally everything that needed a rewrite so badly that it cannot be done in V2.
|
||||||
|
|
||||||
**Q:** So what are the changes if it almost looks the same as V2?
|
**Q:** So what are the changes if it almost looks the same as V2?
|
||||||
**A:** Here's the bullet points of the changes so far;
|
**A:** Here's the bullet points of the changes so far;
|
||||||
- Reworked some of the files
|
- Reworked some of the files
|
||||||
- Commands and events are now classes
|
- Commands and events are now classes
|
||||||
|
@ -14,6 +14,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /var/lib/docker/volumes/daggerbot-db:/var/lib/postgresql/data:rw
|
- /var/lib/docker/volumes/daggerbot-db:/var/lib/postgresql/data:rw
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: ${POSTGRES_USER}
|
POSTGRES_USER: daggerbot
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
POSTGRES_PASSWORD: dagbot
|
||||||
POSTGRES_DB: ${POSTGRES_DB}
|
POSTGRES_DB: daggerbot
|
||||||
|
@ -6,7 +6,7 @@ const RedisClient = createClient({
|
|||||||
url: (await TSClient()).redis_uri,
|
url: (await TSClient()).redis_uri,
|
||||||
database: 0,
|
database: 0,
|
||||||
name: 'Daggerbot',
|
name: 'Daggerbot',
|
||||||
socket: { keepAlive: 15000, timeout: 30000, reconnectStrategy(retries:number = 5) {return Math.min(retries * 76, 1000)} }
|
socket: { keepAlive: 15000, timeout: 30000 }
|
||||||
});
|
});
|
||||||
|
|
||||||
export default class CacheServer {
|
export default class CacheServer {
|
||||||
@ -14,7 +14,16 @@ export default class CacheServer {
|
|||||||
protected static eventManager() {
|
protected static eventManager() {
|
||||||
RedisClient
|
RedisClient
|
||||||
.on('connect', ()=>Logger.console('log', this.prefix, 'Connection to Redis has been established'))
|
.on('connect', ()=>Logger.console('log', this.prefix, 'Connection to Redis has been established'))
|
||||||
.on('error', (err:ErrorReply)=>Logger.console('error', this.prefix, `Encountered an error in Redis: ${err.message}`))
|
.on('error', (err:ErrorReply)=>{
|
||||||
|
Logger.console('error', this.prefix, `Encountered an error in Redis: ${err.message}`)
|
||||||
|
setTimeout(async()=>{
|
||||||
|
if (!RedisClient.isReady) {
|
||||||
|
Logger.console('log', this.prefix, 'Client is zombified, starting a fresh connection...');
|
||||||
|
RedisClient.quit();
|
||||||
|
await RedisClient.connect();
|
||||||
|
}
|
||||||
|
}, 1500)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
public static async get(key:any, jsonMode:boolean):Promise<any> {
|
public static async get(key:any, jsonMode:boolean):Promise<any> {
|
||||||
let cachedResult:any;
|
let cachedResult:any;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Discord from 'discord.js';
|
import Discord from 'discord.js';
|
||||||
import TClient from '../client.js';
|
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 index = member.guild.memberCount;
|
||||||
const suffix = (index=>{
|
const suffix = (index=>{
|
||||||
|
@ -15,7 +15,7 @@ export default class FormatPlayer {
|
|||||||
Days = Math.floor(Hours/24);
|
Days = Math.floor(Hours/24);
|
||||||
Hours = Hours-Days*24;
|
Hours = Hours-Days*24;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Days > 0 ? Days+' d ':'')+(Hours > 0 ? Hours+' h ':'')+(Minutes > 0 ? Minutes+' m':'')
|
return (Days > 0 ? Days+' d ':'')+(Hours > 0 ? Hours+' h ':'')+(Minutes > 0 ? Minutes+' m':'')
|
||||||
}
|
}
|
||||||
static decoratePlayerIcons(player:FSPlayer) {
|
static decoratePlayerIcons(player:FSPlayer) {
|
||||||
|
@ -7,20 +7,22 @@ export default class CmdTrigger {
|
|||||||
return message.content.toLowerCase().startsWith(this.prefix+trigger)
|
return message.content.toLowerCase().startsWith(this.prefix+trigger)
|
||||||
}
|
}
|
||||||
static registerCmds(client:TClient, message:Message, trigger:string) {
|
static registerCmds(client:TClient, message:Message, trigger:string) {
|
||||||
if (!this.SenseTrigger(message, trigger) ?? !client.config.whitelist.includes(message.author.id)) return;
|
if (this.SenseTrigger(message, trigger) && client.config.whitelist.includes(message.author.id)) {
|
||||||
(client.guilds.cache.get(message.guildId) as Guild).commands.set(client.registry)
|
(client.guilds.cache.get(message.guildId) as Guild).commands.set(client.registry)
|
||||||
.then(()=>message.reply('Deployed the slash commands successfully!'))
|
.then(()=>message.reply('Deployed the slash commands successfully!'))
|
||||||
.catch(e=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
|
.catch(e=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static MFPwTrigger(message:Message, trigger:string) {
|
static MFPwTrigger(message:Message, trigger:string) {
|
||||||
if (!this.SenseTrigger(message, trigger)) return;
|
if (this.SenseTrigger(message, trigger)) {
|
||||||
let passwordText = 'The farm password is ';
|
let passwordText = 'The farm password is ';
|
||||||
const mapping = {
|
const mapping = {
|
||||||
'1149138133514981386': 'koops',
|
'1149138133514981386': 'koops',
|
||||||
'1149138202662293555': 'junkers'
|
'1149138202662293555': 'junkers'
|
||||||
}
|
}
|
||||||
for (const [channelId, farmPw] of Object.entries(mapping)) {
|
for (const [channelId, farmPw] of Object.entries(mapping)) {
|
||||||
if (message.channelId === channelId) message.reply(passwordText += `\`${farmPw}\``);
|
if (message.channelId === channelId) message.reply(passwordText += `\`${farmPw}\``);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user