Skip to content

Commit

Permalink
feat(noot): 60% chance for pingu gif
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutonite committed Jun 14, 2022
1 parent e3dfd7f commit 572d360
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ FIREBASE_CLIENT_EMAIL=
FIREBASE_PRIVATE_KEY=
TWITCH_CLIENT_ID=
TWITCH_CLIENT_SECRET=
TWITCH_SUBSCRIPTION_SECRET=
GIPHY_API_KEY=
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ ENV HUSKY=0 \
FIREBASE_PRIVATE_KEY="" \
TWITCH_CLIENT_ID="" \
TWITCH_CLIENT_SECRET="" \
TWITCH_SUBSCRIPTION_SECRET=""
TWITCH_SUBSCRIPTION_SECRET="" \
GIPHY_API_KEY=""

COPY --chown=node:node package-lock.json .
COPY --chown=node:node package.json .
Expand Down
83 changes: 83 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"@discordjs/builders": "^0.15.0",
"@discordjs/rest": "^0.5.0",
"@giphy/js-fetch-api": "^4.2.2",
"@sapphire/decorators": "^4.3.4",
"@sapphire/discord.js-utilities": "^4.11.1",
"@sapphire/fetch": "^2.4.0",
Expand Down
3 changes: 2 additions & 1 deletion src/commands/massimo.command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import { send } from '@sapphire/plugin-editable-commands';
import type { Message } from 'discord.js';

const sentences = [
Expand All @@ -22,7 +23,7 @@ const sentences = [
})
export default class MassimoCommand extends Command {
public override async messageRun(message: Message) {
await message.channel.send({
return send(message, {
content: sentences[Math.floor(Math.random() * sentences.length)],
});
}
Expand Down
24 changes: 22 additions & 2 deletions src/commands/noot.command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { GiphyFetch } from '@giphy/js-fetch-api';
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import { send } from '@sapphire/plugin-editable-commands';
import type { Message } from 'discord.js';

const sentences = [
Expand All @@ -12,15 +14,33 @@ const sentences = [
'NOOT NOOT',
];

const gf = new GiphyFetch(process.env.GIPHY_API_KEY ?? 'unknown');

const sendRandom = async (message: Message) => {
return send(message, {
content: sentences[Math.floor(Math.random() * sentences.length)],
});
};

@ApplyOptions<Command.Options>({
name: 'noot',
description: 'noot noot',
enabled: true,
})
export default class NootCommand extends Command {
public override async messageRun(message: Message) {
await message.channel.send({
content: sentences[Math.floor(Math.random() * sentences.length)],
if (Math.random() > 0.6) {
return sendRandom(message);
}

const res = await gf.random({
tag: 'noot noot',
limit: 1,
rating: 'pg-13',
});

return send(message, {
content: res.data.embed_url,
});
}
}

0 comments on commit 572d360

Please sign in to comment.