aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/pinapelz/FileSystem.java
blob: 1f252a298f95067f5155ce1c8b506a10ffecf165 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.pinapelz;

import net.dv8tion.jda.api.entities.Message;

import java.sql.SQLException;

public class FileSystem {
    private Database database;
    public FileSystem(String dbHost, String dbUser, String dbPass, String dbName){
        database = new Database(dbHost, dbUser, dbPass, dbName);
    }

    public String[] getFileById(int fileId){
        return database.getFileById(fileId);
    }

    public void createNewFile(String channelId, String messageId, String description, Message.Attachment attachment){
        int fileSize = attachment.getSize();
        String filename = attachment.getFileName();
        String mimeType = attachment.getContentType();
        try {
            database.recordFileMetadata(channelId, messageId, 1, filename, description, fileSize, mimeType );
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage