Skip to content

Commit b142aaf

Browse files
committed
Commited from terminal
0 parents  commit b142aaf

23 files changed

+1263
-0
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
TOKEN=your discord bot TOKEN
2+
API_KEY=your api key for api.anondev.ml

.gitignore

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
### Node ###
2+
# Logs
3+
logs
4+
*.log
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
lerna-debug.log*
9+
.pnpm-debug.log*
10+
11+
# Diagnostic reports (https://nodejs.org/api/report.html)
12+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
13+
14+
# Runtime data
15+
pids
16+
*.pid
17+
*.seed
18+
*.pid.lock
19+
20+
# Directory for instrumented libs generated by jscoverage/JSCover
21+
lib-cov
22+
23+
# Coverage directory used by tools like istanbul
24+
coverage
25+
*.lcov
26+
27+
# nyc test coverage
28+
.nyc_output
29+
30+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
31+
.grunt
32+
33+
# Bower dependency directory (https://bower.io/)
34+
bower_components
35+
36+
# node-waf configuration
37+
.lock-wscript
38+
39+
# Compiled binary addons (https://nodejs.org/api/addons.html)
40+
build/Release
41+
42+
# Dependency directories
43+
node_modules/
44+
jspm_packages/
45+
46+
# Snowpack dependency directory (https://snowpack.dev/)
47+
web_modules/
48+
49+
# TypeScript cache
50+
*.tsbuildinfo
51+
52+
# Optional npm cache directory
53+
.npm
54+
55+
# Optional eslint cache
56+
.eslintcache
57+
58+
# Microbundle cache
59+
.rpt2_cache/
60+
.rts2_cache_cjs/
61+
.rts2_cache_es/
62+
.rts2_cache_umd/
63+
64+
# Optional REPL history
65+
.node_repl_history
66+
67+
# Output of 'npm pack'
68+
*.tgz
69+
70+
# Yarn Integrity file
71+
.yarn-integrity
72+
73+
# dotenv environment variables file
74+
.env
75+
.env.test
76+
.env.production
77+
78+
# parcel-bundler cache (https://parceljs.org/)
79+
.cache
80+
.parcel-cache
81+
82+
# Next.js build output
83+
.next
84+
out
85+
86+
# Nuxt.js build / generate output
87+
.nuxt
88+
dist
89+
90+
# Gatsby files
91+
.cache/
92+
# Comment in the public line in if your project uses Gatsby and not Next.js
93+
# https://nextjs.org/blog/next-9-1#public-directory-support
94+
# public
95+
96+
# vuepress build output
97+
.vuepress/dist
98+
99+
# Serverless directories
100+
.serverless/
101+
102+
# FuseBox cache
103+
.fusebox/
104+
105+
# DynamoDB Local files
106+
.dynamodb/
107+
108+
# TernJS port file
109+
.tern-port
110+
111+
# Stores VSCode versions used for testing VSCode extensions
112+
.vscode-test
113+
114+
# yarn v2
115+
.yarn/cache
116+
.yarn/unplugged
117+
.yarn/build-state.yml
118+
.yarn/install-state.gz
119+
.pnp.*
120+
121+
prettier.config.js
122+
json.sqlite
123+
.breakpoints
124+
package-lock.json

.replit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
run = "npm start"
2+
language = "nodejs"

commands/images/animal.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
const {
2+
Command,
3+
MessageActionRow,
4+
MessageButton,
5+
ArgumentType,
6+
} = require("gcommands");
7+
const Discord = require("discord.js");
8+
9+
module.exports = class extends Command {
10+
constructor(...args) {
11+
super(...args, {
12+
name: "animal",
13+
description: "Get random animal",
14+
args: [
15+
{
16+
name: "animal",
17+
type: ArgumentType.STRING,
18+
description: "Animal to get image of",
19+
required: true,
20+
choices: [
21+
{ name: "Cat", value: "cat" },
22+
{ name: "Dog", value: "dog" },
23+
{ name: "Fox", value: "fox" },
24+
{ name: "Panda", value: "panda" },
25+
{ name: "Red Panda", value: "red_panda" },
26+
{ name: "Bird", value: "bird" },
27+
{ name: "Koala", value: "koala" },
28+
{ name: "Raccoon", value: "raccoon" },
29+
{ name: "Kangaroo", value: "kangaroo" },
30+
{ name: "Shiba", value: "shiba" },
31+
],
32+
},
33+
],
34+
});
35+
}
36+
async run({
37+
client,
38+
interaction,
39+
respond,
40+
guild,
41+
edit,
42+
member,
43+
author,
44+
args,
45+
objectArgs,
46+
message,
47+
}) {
48+
const resp = await client
49+
.request(`/api/images/${objectArgs.animal}`, "GET")
50+
.catch((err) => {
51+
console.log("Error while fetching API endpoint", err);
52+
return respond({
53+
content: `:x: Error while fetching API endpoint \`${err.message}\``,
54+
ephemeral: true,
55+
});
56+
});
57+
let data = await resp.json();
58+
if (!resp.ok) {
59+
console.log(`API returned error ${resp.status} ${resp.statusText}`, data);
60+
return respond({
61+
content: `:x: API returned error \`${resp.status} ${
62+
resp.statusText
63+
}\`\n\n> \`${JSON.stringify(data)}\``,
64+
ephemeral: true,
65+
});
66+
}
67+
68+
const embed = new Discord.MessageEmbed()
69+
.setTitle(`${client.helpers.capitalize(objectArgs.animal)}`)
70+
.setImage(data.url)
71+
.setColor("RANDOM")
72+
.setFooter(client.user.username, client.user.avatarURL())
73+
.setTimestamp();
74+
75+
respond({
76+
embeds: [embed],
77+
ephemeral: false,
78+
});
79+
}
80+
};

commands/images/changemymind.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const {
2+
Command,
3+
MessageActionRow,
4+
MessageButton,
5+
ArgumentType,
6+
} = require("gcommands");
7+
const Discord = require("discord.js");
8+
9+
module.exports = class extends Command {
10+
constructor(...args) {
11+
super(...args, {
12+
name: "changemymind",
13+
description: "Generate change my mind meme",
14+
args: [
15+
{
16+
name: "text",
17+
type: ArgumentType.STRING,
18+
description: "Text",
19+
required: true,
20+
},
21+
],
22+
});
23+
}
24+
async run({
25+
client,
26+
interaction,
27+
respond,
28+
guild,
29+
edit,
30+
member,
31+
author,
32+
args,
33+
objectArgs,
34+
message,
35+
}) {
36+
const resp = await client
37+
.request(
38+
`/api/images/changemymind?text=${encodeURIComponent(objectArgs.text)}`,
39+
"GET"
40+
)
41+
.catch((err) => {
42+
console.log("Error while fetching API endpoint", err);
43+
return respond({
44+
content: `:x: Error while fetching API endpoint \`${err.message}\``,
45+
ephemeral: true,
46+
});
47+
});
48+
let data = await resp.json();
49+
if (!resp.ok) {
50+
console.log(`API returned error ${resp.status} ${resp.statusText}`, data);
51+
return respond({
52+
content: `:x: API returned error \`${resp.status} ${
53+
resp.statusText
54+
}\`\n\n> \`${JSON.stringify(data)}\``,
55+
ephemeral: true,
56+
});
57+
}
58+
59+
const embed = new Discord.MessageEmbed()
60+
.setTitle(`Change My Mind`)
61+
.setImage(data.url)
62+
.setColor("RANDOM")
63+
.setFooter(client.user.username, client.user.avatarURL())
64+
.setTimestamp();
65+
66+
respond({
67+
embeds: [embed],
68+
ephemeral: false,
69+
});
70+
}
71+
};

commands/images/clyde.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const {
2+
Command,
3+
MessageActionRow,
4+
MessageButton,
5+
ArgumentType,
6+
} = require("gcommands");
7+
const Discord = require("discord.js");
8+
9+
module.exports = class extends Command {
10+
constructor(...args) {
11+
super(...args, {
12+
name: "clyde",
13+
description: "Generate Clyde Discord bot image",
14+
args: [
15+
{
16+
name: "text",
17+
type: ArgumentType.STRING,
18+
description: "Text",
19+
required: true,
20+
},
21+
],
22+
});
23+
}
24+
async run({
25+
client,
26+
interaction,
27+
respond,
28+
guild,
29+
edit,
30+
member,
31+
author,
32+
args,
33+
objectArgs,
34+
message,
35+
}) {
36+
const resp = await client
37+
.request(
38+
`/api/images/clyde?text=${encodeURIComponent(objectArgs.text)}`,
39+
"GET"
40+
)
41+
.catch((err) => {
42+
console.log("Error while fetching API endpoint", err);
43+
return respond({
44+
content: `:x: Error while fetching API endpoint \`${err.message}\``,
45+
ephemeral: true,
46+
});
47+
});
48+
let data = await resp.json();
49+
if (!resp.ok) {
50+
console.log(`API returned error ${resp.status} ${resp.statusText}`, data);
51+
return respond({
52+
content: `:x: API returned error \`${resp.status} ${
53+
resp.statusText
54+
}\`\n\n> \`${JSON.stringify(data)}\``,
55+
ephemeral: true,
56+
});
57+
}
58+
59+
const embed = new Discord.MessageEmbed()
60+
.setTitle(`Clyde`)
61+
.setImage(data.url)
62+
.setColor("RANDOM")
63+
.setFooter(client.user.username, client.user.avatarURL())
64+
.setTimestamp();
65+
66+
respond({
67+
embeds: [embed],
68+
ephemeral: false,
69+
});
70+
}
71+
};

0 commit comments

Comments
 (0)