in progress

main
kry008 2024-06-08 09:08:26 +02:00
parent e39979fee8
commit cb1305db40
3 changed files with 176 additions and 30 deletions

View File

@ -0,0 +1,55 @@
var cloudFlareErrors = {
"1000": {"message": "DNS points to prohibited IP", "description": "An A record within your Cloudflare DNS app points to a Cloudflare IP address, or a Load Balancer Origin points to a proxied record, or\nYour Cloudflare DNS A or CNAME record references another reverse proxy (such as an nginx web server that uses the proxy_pass function) that then proxies the request to Cloudflare a second time, or\nThe request X-Forwarded-For header is longer than 100 characters, or\nThe request includes two X-Forwarded-For headers, or\nThe request includes a CF-Connecting-IP header, or\nA Server Name Indication (SNI) issue or mismatch at the origin", "common_causes": "- If an A record within your Cloudflare DNS app points to a Cloudflare IP address, update the IP address to your origin web server IP address. Reach out to your hosting provider if you need help obtaining the origin IP address.\n- There is a reverse-proxy at your origin that sends the request back through the Cloudflare proxy. Instead of using a reverse-proxy, contact your hosting provider or site administrator to configure an HTTP redirect at your origin"},
"1004": {"message": "Host Not Configured to Serve Web Traffic", "description": "The host is not configured in the Cloudflare dashboard.", "common_causes": "- Cloudflare staff disabled proxying for the domain due to abuse or terms of service violations.\n-DNS changes have not yet propagated or the site owners DNS A records point to Cloudflare IP addresses"}
};
function returnCloudFlareError(code) {
if (code in cloudFlareErrors) {
return cloudFlareErrors[code];
} else {
return {"message": "Unknown Cloudflare Error\n# Function WORK IN PROGRESS", "description": "The Cloudflare error code provided is not recognized."};
}
}
module.exports = {
name: 'cloudflareerrors',
description: 'Get description of Cloudflare error codes',
help: 'Get description of Cloudflare error codes *WORK IN PROGRESS*',
options: [
{
name: 'r',
type: 4, // Integer type
description: 'Cloudflare error code (e.g. 1004)',
required: true
},
],
slash: false,
text: false,
admin: false,
requireKick: false,
requireBan: false,
canBeUsedInDm: true,
contexts: ['GUILD_TEXT', 'GUILD_VOICE', 'DM'],
integration_types: [0,1],
execute(message, args) {
//check if the user provided the 3 values 0-255
const codeER = args.r;
const errorCF = returnCloudFlareError(codeER);
if(errorCF.common_causes != null) {
message.reply(`# Cloudflare ${codeER} ${errorCF.message}: \n${errorCF.description}\n\nCommon Causes:\n${errorCF.common_causes}`);
}
else {
message.reply(`# Cloudflare ${codeER} ${errorCF.message}: \n${errorCF.description}`);
}
},
executeSlash(interaction) {
const codeER = interaction.options.getInteger('r');
const errorCF = returnCloudFlareError(codeER);
if(errorCF.common_causes != null) {
interaction.reply(`# Cloudflare ${codeER} ${errorCF.message}: \n${errorCF.description}\n\nCommon Causes:\n${errorCF.common_causes}`);
}
else {
interaction.reply(`# Cloudflare ${codeER} ${errorCF.message}: \n${errorCF.description}`);
}
},
};

View File

@ -3,36 +3,6 @@ const fs = require('fs');
const pokemon_games = JSON.parse(fs.readFileSync('databases/pokemon_games.json'));
const pokemon = JSON.parse(fs.readFileSync('databases/pokemon.json'));
/*pokemon.json
[
{
"number": 1,
"name": "Bulbasaur",
"img": "https://en.wikipedia.org/wiki/Bulbasaur#/media/File:Pok%C3%A9mon_Bulbasaur_art.png",
"type": [
"Grass",
"Poison"
],
"height": "0.7 m",
"weight": "6.9 kg",
"first_appeared": 1,
"some_facts": [
"Bulbasaur is the first Pokémon in the National Pokédex.",
"Bulbasaur is the only dual-type Pokémon in the National Pokédex that is both Poison and Grass type.",
"Bulbasaur is the only Pokémon that can learn Frenzy Plant, Blast Burn, and Hydro Cannon."
]
},
pokemon_games.json
[
{
"id": 1,
"name": "Pokémon Red and Blue",
"year": 1996
}
*/
function randomPokemon() {
//connect data from pokemon.json and pokemon_games.json
const randomPokemon = pokemon[Math.floor(Math.random() * pokemon.length)];

View File

@ -0,0 +1,121 @@
const { EmbedBuilder } = require('discord.js');
function randomColor() {
return Math.floor(Math.random()*16777215).toString(16);
}
module.exports = {
name: 'supportbot',
description: 'How to support bot development?',
help: 'How to support bot development?',
options: [],
slash: false,
text: false,
admin: false,
requireKick: false,
requireBan: false,
canBeUsedInDm: true,
contexts: ['GUILD_TEXT', 'GUILD_VOICE', 'DM'],
integration_types: [0,1],
execute(message, args) {
const msg = {
color: 0x0099ff,
title: 'Some title',
url: 'https://discord.js.org',
author: {
name: 'Some name',
icon_url: 'https://i.imgur.com/AfFp7pu.png',
url: 'https://discord.js.org',
},
description: 'Some description here',
thumbnail: {
url: 'https://i.imgur.com/AfFp7pu.png',
},
fields: [
{
name: 'Regular field title',
value: 'Some value here',
},
{
name: '\u200b',
value: '\u200b',
inline: false,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
],
image: {
url: 'https://i.imgur.com/AfFp7pu.png',
},
timestamp: new Date().toISOString(),
footer: {
text: 'Some footer text here',
icon_url: 'https://i.imgur.com/AfFp7pu.png',
},
};
message.reply({ embeds: msg });
},
executeSlash(interaction) {
const msg = {
color: 0x0099ff,
title: 'Some title',
url: 'https://discord.js.org',
author: {
name: 'Some name',
icon_url: 'https://i.imgur.com/AfFp7pu.png',
url: 'https://discord.js.org',
},
description: 'Some description here',
thumbnail: {
url: 'https://i.imgur.com/AfFp7pu.png',
},
fields: [
{
name: 'Regular field title',
value: 'Some value here',
},
{
name: '\u200b',
value: '\u200b',
inline: false,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
],
image: {
url: 'https://i.imgur.com/AfFp7pu.png',
},
timestamp: new Date().toISOString(),
footer: {
text: 'Some footer text here',
icon_url: 'https://i.imgur.com/AfFp7pu.png',
},
};
interaction.reply({ embeds: msg });
},
};