mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 20:30:58 -05:00
Add raw SQL query support
This commit is contained in:
parent
1d02e781dc
commit
ab9e88c263
@ -55,6 +55,7 @@ export class MPServerSvc {
|
||||
})
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
async fetchPlayerData(serverName:string) {
|
||||
const findServerByName = await this.model.findOne({where: {serverName: serverName}});
|
||||
if (findServerByName) return findServerByName.dataValues.playerData;
|
||||
|
@ -30,6 +30,7 @@ export class DailyMsgsSvc {
|
||||
})
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
nukeDays = async()=>await this.model.destroy({truncate: true});
|
||||
fetchDays = async()=>await this.model.findAll();
|
||||
async newDay(formattedDate:number, total:number) {
|
||||
|
@ -25,6 +25,7 @@ export class ProhibitedWordsSvc {
|
||||
})
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
findWord = async(word:string)=>await this.model.findByPk(word);
|
||||
getAllWords = async()=>await this.model.findAll();
|
||||
insertWord = async(word:string)=>await this.model.create({word: word});
|
||||
|
@ -83,6 +83,7 @@ export class PunishmentsSvc {
|
||||
});
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
async updateReason(caseId:number, reason:string) {
|
||||
const findCase = this.findCase(caseId);
|
||||
if (findCase) return this.model.update({reason: reason}, {where: {case_id: caseId}});
|
||||
|
@ -40,6 +40,7 @@ export class SuggestionsSvc {
|
||||
})
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
fetchById = async(id:number)=>await this.model.findByPk(id);
|
||||
updateStatus = async(id:number, status:string)=>await this.model.update({status: status}, {where: {id: id}});
|
||||
create =(userid:string, description:string)=>this.model.create({userid: userid, suggestion: description, status: 'Pending'})
|
||||
|
@ -50,6 +50,7 @@ export class TagSystemSvc {
|
||||
});
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
async createTag(userid:string, tagName:string, message:string, embedFlag:boolean) {
|
||||
CacheServer.delete('tags');
|
||||
return await this.model.create({userid: userid, tagname: tagName, message: message.replace(/\\n/g, '\n'), embedFlag: embedFlag});
|
||||
|
@ -57,6 +57,7 @@ export class UserLevelsSvc {
|
||||
});
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
fetchEveryone = async()=>await this.model.findAll();
|
||||
fetchUser = async(userId:string)=>await this.model.findByPk(userId);
|
||||
deleteUser = async(userId:string)=>await this.model.destroy({where: {id: userId}});
|
||||
|
@ -34,6 +34,7 @@ export class YouTubeChannelsSvc {
|
||||
})
|
||||
this.model.sync();
|
||||
}
|
||||
query = async(pattern:string)=>await this.model.sequelize.query(pattern);
|
||||
async addChannel(YTChannelID:string, DCChannelID:string, DCRole:string) {
|
||||
if (await this.model.findOne({where: {ytchannel: YTChannelID}})) return false;
|
||||
await this.model.create({ytchannel: YTChannelID, dcchannel: DCChannelID, dcrole: DCRole});
|
||||
|
Loading…
Reference in New Issue
Block a user