mirror of
https://github.com/Myxelium/RandomMemerBot.git
synced 2026-07-09 06:25:08 +00:00
Add database
This commit is contained in:
11
client/data/addSound.ts
Normal file
11
client/data/addSound.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { database } from "../database";
|
||||
|
||||
export function AddSoundToDatabase(
|
||||
fileName: string,
|
||||
guild: string = "unknown",
|
||||
user: string = "unknown"
|
||||
) {
|
||||
database.serialize(async () => {
|
||||
await database.run('INSERT INTO sounds (name, guild, user, date) VALUES (?,?,?,?)', [fileName, guild, user, new Date().toISOString()]);
|
||||
});
|
||||
}
|
||||
9
client/data/deleteSound.ts
Normal file
9
client/data/deleteSound.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { database } from "../database";
|
||||
|
||||
export function DeleteSoundFromDatabase(
|
||||
fileName: string
|
||||
) {
|
||||
database.serialize(async () => {
|
||||
await database.run('DELETE FROM sounds WHERE name = ?', [fileName]);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user