mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 16:30:58 -05:00
Compare commits
4 Commits
d434507b9b
...
c88c252d99
Author | SHA1 | Date | |
---|---|---|---|
|
c88c252d99 | ||
|
b151f04c48 | ||
|
1c3c14a159 | ||
|
543a84a433 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.env
|
||||
# Yarn stuff
|
||||
.yarn
|
||||
# TypeScript stuff
|
||||
|
@ -14,6 +14,6 @@ services:
|
||||
volumes:
|
||||
- /var/lib/docker/volumes/daggerbot-db:/var/lib/postgresql/data:rw
|
||||
environment:
|
||||
POSTGRES_USER: daggerbot
|
||||
POSTGRES_PASSWORD: dagbot
|
||||
POSTGRES_DB: daggerbot
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
|
@ -6,7 +6,7 @@ const RedisClient = createClient({
|
||||
url: (await TSClient()).redis_uri,
|
||||
database: 0,
|
||||
name: 'Daggerbot',
|
||||
socket: { keepAlive: 15000, timeout: 30000 }
|
||||
socket: { keepAlive: 15000, timeout: 30000, reconnectStrategy(retries:number = 5) {return Math.min(retries * 76, 1000)} }
|
||||
});
|
||||
|
||||
export default class CacheServer {
|
||||
@ -14,16 +14,7 @@ export default class CacheServer {
|
||||
protected static eventManager() {
|
||||
RedisClient
|
||||
.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}`)
|
||||
setTimeout(async()=>{
|
||||
if (!RedisClient.isReady) {
|
||||
Logger.console('log', this.prefix, 'Client is zombified, starting a fresh connection...');
|
||||
RedisClient.quit();
|
||||
await RedisClient.connect();
|
||||
}
|
||||
}, 1500)
|
||||
})
|
||||
.on('error', (err:ErrorReply)=>Logger.console('error', this.prefix, `Encountered an error in Redis: ${err.message}`))
|
||||
}
|
||||
public static async get(key:any, jsonMode:boolean):Promise<any> {
|
||||
let cachedResult:any;
|
||||
|
@ -7,14 +7,13 @@ export default class CmdTrigger {
|
||||
return message.content.toLowerCase().startsWith(this.prefix+trigger)
|
||||
}
|
||||
static registerCmds(client:TClient, message:Message, trigger:string) {
|
||||
if (this.SenseTrigger(message, trigger) && client.config.whitelist.includes(message.author.id)) {
|
||||
if (!this.SenseTrigger(message, trigger) ?? !client.config.whitelist.includes(message.author.id)) return;
|
||||
(client.guilds.cache.get(message.guildId) as Guild).commands.set(client.registry)
|
||||
.then(()=>message.reply('Deployed the slash commands successfully!'))
|
||||
.catch(e=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
|
||||
}
|
||||
}
|
||||
static MFPwTrigger(message:Message, trigger:string) {
|
||||
if (this.SenseTrigger(message, trigger)) {
|
||||
if (!this.SenseTrigger(message, trigger)) return;
|
||||
let passwordText = 'The farm password is ';
|
||||
const mapping = {
|
||||
'1149138133514981386': 'koops',
|
||||
@ -25,4 +24,3 @@ export default class CmdTrigger {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user