You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,8 @@ You should also change settings for database connection. Supported database back
93
93
Example: `"./storage.db"`
94
94
-`mongodb` - MongoDB database. Connection string should be a valid MongoDB connection string.
95
95
Example: `"mongodb://127.0.0.1:27017/dbname"`
96
+
-`postgres` - PostgreSQL database. Database must be created manually (tables will be created automatically). Connection string should be a valid PostgreSQL connection string.
awaitthis.client.query('UPDATE guilds SET prefix = $1, language = $2, xp_enabled = $3, automod_enabled = $4, welcome_channel = $5, welcome_msg = $6, log_channel = $7 WHERE id = $8',[guild.prefix,guild.language,guild.xp_enabled,guild.automod_enabled,guild.welcome_channel,guild.welcome_msg,guild.log_channel,guild.id]);
56
+
}
57
+
asyncdeleteGuild(guild_id){
58
+
awaitthis.client.query('DELETE FROM guilds WHERE id = $1',[guild_id]);
59
+
}
60
+
61
+
asyncgetUsers(guild_id){
62
+
constusers=awaitthis.client.query('SELECT * FROM users WHERE guild_id = $1 ORDER BY xp DESC',[guild_id]);
63
+
returnusers.rows;
64
+
}
65
+
asyncgetUser(user_id,guild_id){
66
+
constuser=awaitthis.client.query('SELECT * FROM users WHERE id = $1 AND guild_id = $2',[user_id,guild_id]);
67
+
returnuser.rows[0];
68
+
}
69
+
asynccreateUser(user){
70
+
awaitthis.client.query('INSERT INTO users (id, guild_id, xp) VALUES ($1, $2, $3)',[user.id,user.guild_id,user.xp]);
71
+
}
72
+
asyncupdateUser(user){
73
+
awaitthis.client.query('UPDATE users SET xp = $1 WHERE id = $2 AND guild_id = $3',[user.xp,user.id,user.guild_id]);
74
+
}
75
+
asyncdeleteUser(user_id,guild_id){
76
+
awaitthis.client.query('DELETE FROM users WHERE id = $1 AND guild_id = $2',[user_id,guild_id]);
77
+
}
78
+
79
+
asyncgetProfiles(){
80
+
constprofiles=awaitthis.client.query('SELECT * FROM profiles');
81
+
returnprofiles.rows;
82
+
}
83
+
asyncgetProfile(user_id){
84
+
constprofile=awaitthis.client.query('SELECT * FROM profiles WHERE id = $1',[user_id]);
85
+
returnprofile.rows[0];
86
+
}
87
+
asynccreateProfile(profile){
88
+
awaitthis.client.query('INSERT INTO profiles (id, description, color) VALUES ($1, $2, $3)',[profile.id,profile.description,profile.color]);
89
+
}
90
+
asyncupdateProfile(profile){
91
+
awaitthis.client.query('UPDATE profiles SET description = $1, color = $2 WHERE id = $3',[profile.description,profile.color,profile.id]);
92
+
}
93
+
asyncdeleteProfile(user_id){
94
+
awaitthis.client.query('DELETE FROM profiles WHERE id = $1',[user_id]);
95
+
}
96
+
97
+
asyncgetCustomCommands(guild_id){
98
+
constcustom_commands=awaitthis.client.query('SELECT * FROM custom_commands WHERE guild_id = $1',[guild_id]);
99
+
returncustom_commands.rows;
100
+
}
101
+
asyncgetCustomCommand(guild_id,command_name){
102
+
constcustom_command=awaitthis.client.query('SELECT * FROM custom_commands WHERE guild_id = $1 AND command_name = $2',[guild_id,command_name]);
103
+
returncustom_command.rows[0];
104
+
}
105
+
asynccreateCustomCommand(custom_command){
106
+
awaitthis.client.query('INSERT INTO custom_commands (guild_id, command_name, response) VALUES ($1, $2, $3)',[custom_command.guild_id,custom_command.command_name,custom_command.response]);
107
+
}
108
+
asyncupdateCustomCommand(custom_command){
109
+
awaitthis.client.query('UPDATE custom_commands SET response = $1 WHERE guild_id = $2 AND command_name = $3',[custom_command.response,custom_command.guild_id,custom_command.command_name]);
110
+
}
111
+
asyncdeleteCustomCommand(guild_id,command_name){
112
+
awaitthis.client.query('DELETE FROM custom_commands WHERE guild_id = $1 AND command_name = $2',[guild_id,command_name]);
113
+
}
114
+
115
+
asyncgetStats(){
116
+
conststats=awaitthis.client.query('SELECT * FROM stats');
117
+
if(stats.rows.length===0){
118
+
awaitthis.client.query('INSERT INTO stats (commands_executed, slash_commands) VALUES (0, 0)');
0 commit comments