Remove Pastebin Function

This commit is contained in:
NekoMonci12
2025-06-03 11:58:26 +07:00
parent bf8109797f
commit c368fe1838
3 changed files with 0 additions and 59 deletions

View File

@@ -7,7 +7,6 @@ OPENAI_BASE_URL=https://api.deepseek.com/chat/completions
MONGO_URL=mongodb://username:password@localhost:27000
MONGO_DB_NAME=RakunNakun
PASTEBIN_DEV_KEY=PASTEBIN_DEVELOPER_KEY
MYSQL_HOST=localhost
MYSQL_PORT=3306

View File

@@ -9,7 +9,6 @@ const Database = require('./database');
const CommandDeployer = require('./deploy-commands');
const HybridCacheManager = require('./hybridCacheManager');
const MessageSplitter = require('./messageSplitter');
const PastebinClient = require('./pastebinClient');
const { MessageFlags } = require('discord-api-types/v10');
// ——— Logging Helpers ———
@@ -35,7 +34,6 @@ const cache = new HybridCacheManager(
process.env.MONGO_DB_NAME
);
const splitter = new MessageSplitter(2000);
const pastebin = new PastebinClient(process.env.PASTEBIN_DEV_KEY);
(async () => {
// 1⃣ Database tables

View File

@@ -1,56 +0,0 @@
// pastebinClient.js
const axios = require('axios');
const qs = require('qs'); // for form URL-encoded data
class PastebinClient {
/**
* Create a new PastebinClient instance.
* @param {string} devKey - Your Pastebin developer key.
*/
constructor(devKey) {
this.devKey = devKey;
this.apiUrl = 'https://pastebin.com/api/api_post.php';
}
/**
* Creates a new paste on Pastebin.
* @param {string} text - The text to paste.
* @param {string} expireDate - Expiration for the paste (e.g. '1M' for 1 month).
* @param {string} pasteName - Optional paste title.
* @param {string} pasteFormat - Optional paste format.
* @param {number} pastePrivate - 0=public, 1=unlisted, 2=private.
* @returns {Promise<string>} - The URL of the created paste.
*/
async createPaste(text, expireDate = '1M', pasteName = 'Chat Log', pasteFormat = '', pastePrivate = 1) {
// Prepare the payload as form URL encoded data.
const payload = {
api_dev_key: this.devKey,
api_option: 'paste',
api_paste_code: text,
api_paste_expire_date: expireDate, // "1M" for 1 month
api_paste_name: pasteName,
api_paste_format: pasteFormat,
api_paste_private: pastePrivate,
};
try {
const response = await axios.post(this.apiUrl, qs.stringify(payload), {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
// If Pastebin returns a URL, then paste creation succeeded.
// If not, it might return an error message.
if (response.data.startsWith('http')) {
return response.data;
} else {
throw new Error(`Pastebin error: ${response.data}`);
}
} catch (error) {
throw new Error(`Pastebin API request failed: ${error.message}`);
}
}
}
module.exports = PastebinClient;