Skip to content

Commit

Permalink
Merge pull request #55 from Blvckleg/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
sanriodev authored Feb 24, 2024
2 parents 9d58f7a + 1b3c9df commit 68a538d
Show file tree
Hide file tree
Showing 23 changed files with 698 additions and 36 deletions.
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@
{
"type": "node",
"request": "launch",
"name": "start:dev",
"name": "start",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"envFile": "${workspaceFolder}/.env",
"runtimeArgs": ["run-script", "start:debug"],
"skipFiles": ["<node_internals>/**"]
},
{
"type": "node",
"request": "launch",
"name": "start:dev",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"envFile": "${workspaceFolder}/.env.dev",
"runtimeArgs": ["run-script", "start:debug"],
"skipFiles": ["<node_internals>/**"]
}
]

}
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
Status: In Development 🛠️
🤖 Description:

Latest: 1.1.0
BingusBoingus is the bot you never knew you needed, mainly because it not really useful and just very silly instead! With BingusBoingus, expect the unexpected, and prepare for some hilariously quirky and utterly pointless commands that will make you wonder, "Why does this bot even exist?"

🤖 Description:
🪄 Features:

- Random Responses: BingusBoingus excels at delivering responses that are both baffling and comical.

BingusBoingus is the bot you never knew you needed, mainly because it doesn't exist yet! This Discord bot repository is currently just a twinkle in the eyes of our imaginary developers. With BingusBoingus, expect the unexpected, and prepare for some hilariously quirky and utterly pointless commands that will make you wonder, "Why does this bot even exist?"
- Coinflip: Ask Bingus to toss a coin for you. It might land on heads. It might land on tails. Or it might...

🪄 Features (not really):
- Saving Quotes: BingusBoingus is able to save quotes in a database.

Random Responses: BingusBoingus excels at delivering responses that are both baffling and comical. Ask it a question, and you might get a recipe for mashed potatoes in return.
- 404 Error: This bot's purpose is as elusive as a unicorn, so prepare to have your expectations shattered.

Virtual Tea Party: Join the bot in its daily virtual tea party where it discusses the weather with itself.
And more....

404 Error: This bot's purpose is as elusive as a unicorn, so prepare to have your expectations shattered.
For more information on commands and how to use them please check the [BingusBoingus Wiki](https://github.com/Blvckleg/BingusBoingus/wiki)

🎉 Coming Soon (or not):

Expand All @@ -22,15 +24,11 @@ Virtual Tea Party: Join the bot in its daily virtual tea party where it discusse

- Occasional Nonsense: The bot will occasionally send you random, nonsensical messages to keep you on your toes.

- Also:

- And coming soon:

- maybe even:
- Virtual Tea Party: Join the bot in its daily virtual tea party where it discusses the weather with itself.

Stay tuned for more updates on BingusBoingus, the Discord bot that's sillier than a rubber chicken in a tuxedo!

This repository follows a structured Git branching workflow:
## This repository follows a structured Git branching workflow:

- Branch Creation: Start a new branch for each feature or bug fix.
- Commits: Make changes and commit with clear messages following the conventional commit messages.
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ services:
volumes:
- ./infra/mongo:/db/data:rw
- ./infra/mongo/mongo.conf:/etc/mongo/mongo.conf:ro
- ./infra/mongo/init.js:/docker-entrypoint-initdb.d/init.js:ro
env_file:
- ./infra/mongo/.env
command:
Expand Down
5 changes: 0 additions & 5 deletions infra/mongo/init.js

This file was deleted.

29 changes: 29 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 @@ -34,6 +34,7 @@
"@nestjs/platform-express": "^10.2.6",
"@nestjs/testing": "^10.2.6",
"@types/jest": "^29.5.5",
"class-validator": "^0.14.1",
"discord-interactions": "^3.4.0",
"discord.js": "^14.13.0",
"dotenv": "^16.3.1",
Expand Down
7 changes: 5 additions & 2 deletions src/modules/command/command.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { BugReport } from './commands/bug';
import { CoinflipCommand } from './commands/coinflip';
import { GoldCommand } from './commands/gold';
import SomeoneOnceSaidCommand from './commands/someone-once-said';
import { SomeoneOnceSaidModule } from '../someone-once-said/modules/someone-once-said.module';
import { SomeoneOnceSaidModule } from '../someone-once-said/module/someone-once-said.module';
import GetRandomQuote from './commands/get-a-quote';
import { PollCommand } from './commands/poll';
import { PollModule } from '../poll/module/poll.module';

@Module({
providers: [
Expand All @@ -23,8 +25,9 @@ import GetRandomQuote from './commands/get-a-quote';
GoldCommand,
SomeoneOnceSaidCommand,
GetRandomQuote,
PollCommand
],
imports: [SomeoneOnceSaidModule],
imports: [SomeoneOnceSaidModule, PollModule],
exports: [CommandService],
})
export class CommandModule {}
3 changes: 3 additions & 0 deletions src/modules/command/command.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CoinflipCommand } from './commands/coinflip';
import { GoldCommand } from './commands/gold';
import SomeoneOnceSaidCommand from './commands/someone-once-said';
import GetRandomQuote from './commands/get-a-quote';
import { PollCommand } from './commands/poll';

@Injectable()
export class CommandService {
Expand All @@ -23,6 +24,7 @@ export class CommandService {
goldModule: GoldCommand,
someoneOnceSaidModule: SomeoneOnceSaidCommand,
getRandomQuoteModule: GetRandomQuote,
pollModule: PollCommand
) {
const commands: ACommand[] = [
//pingpongModule,
Expand All @@ -34,6 +36,7 @@ export class CommandService {
goldModule,
someoneOnceSaidModule,
getRandomQuoteModule,
pollModule
];
commands.forEach((command) => {
if (command.data.name && command.execute) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/command/commands/get-a-quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SlashCommandBuilder,
} from 'discord.js';
import { ACommand } from '../command.abstract';
import { SomeoneOnceSaidService } from '../../someone-once-said/services/someone-once-said.service';
import { SomeoneOnceSaidService } from '../../someone-once-said/service/someone-once-said.service';
import { Inject } from '@nestjs/common';

export default class GetRandomQuote extends ACommand {
Expand Down
99 changes: 99 additions & 0 deletions src/modules/command/commands/poll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { Inject, Injectable } from '@nestjs/common';
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
EmbedBuilder,
SlashCommandBuilder,
} from 'discord.js';
import { ACommand } from '../command.abstract';
import { PollService } from '../../poll/service/poll.service';
import { PollEntity } from '../../../schemas/poll-entity.model';

@Injectable()
export class PollCommand extends ACommand {
constructor(
@Inject(PollService)
private readonly pollService: PollService,
) {
super();
}
data = new SlashCommandBuilder()
.setName('poll')
.setDescription('Start a poll in your channel!')
.addStringOption((option) =>
option
.setName('topic')
.setDescription('the topic of your poll')
.setMinLength(5)
.setMaxLength(200)
.setRequired(true),
);

public execute(arg: any /*Interaction<CacheType>*/): Promise<boolean> {
return this.run(async () => {
const author = arg.user.displayName ?? arg.user.username;
await arg.reply({
content: `${author} has started a new poll!`,
ephemeral: true,
});

const topic = await arg.options.getString('topic');

const embed = new EmbedBuilder()
.setColor('Aqua')
.setAuthor({ name: author })
.setFooter({ text: 'poll started 🤚' })
.setTimestamp()
.setTitle('📍 vote now!')
.setDescription(`> ${topic}`)
.addFields({
name: 'Upvotes 👍',
value: '> **No votes**',
inline: true,
})
.addFields({
name: 'Downvotes 👎',
value: '> **No votes**',
inline: true,
})
.addFields({
name: 'Author',
value: `> ${arg.user}`,
inline: true,
});

const buttons = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId('up')
.setLabel('⬆️')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('down')
.setLabel('⬇️')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('close')
.setLabel('⚠️ close')
.setStyle(ButtonStyle.Danger),
);

const message = await arg.channel.send({ embeds: [embed], components: [buttons]});

message.createMessageComponentCollector();

let pollentity: PollEntity = {
msg: message.id,
upvotes: 0,
downvotes: 0,
upMembers: [],
downMembers: [],
active: true,
ownerName: arg.user.username,
createdAt: new Date()
}
await this.pollService.create(pollentity);
return true;
});
}
}
2 changes: 1 addition & 1 deletion src/modules/command/commands/someone-once-said.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SlashCommandBuilder,
} from 'discord.js';
import { ACommand } from '../command.abstract';
import { SomeoneOnceSaidService } from '../../someone-once-said/services/someone-once-said.service';
import { SomeoneOnceSaidService } from '../../someone-once-said/service/someone-once-said.service';
import { Inject } from '@nestjs/common';
import { SomeoneOnceSaid } from '../../../schemas/someone-once-said.schema';

Expand Down
3 changes: 2 additions & 1 deletion src/modules/event/event.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { Interaction } from './services/interaction';
import { MessageEvent } from './services/messageEvent';
import { DiscordModule } from '../discord/discord.module';
import { CommandModule } from '../command/command.module';
import { PollModule } from '../poll/module/poll.module';

@Module({
imports: [DiscordModule, CommandModule],
imports: [DiscordModule, CommandModule, PollModule],
providers: [EventService, ClientReady, Interaction, MessageEvent],
exports: [EventService],
})
Expand Down
28 changes: 28 additions & 0 deletions src/modules/event/services/interaction.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Test, TestingModule } from '@nestjs/testing';
import { Interaction } from './interaction';
import { CommandService } from '../../command/command.service';
import { PollService } from '../../poll/service/poll.service';

describe('Interaction', () => {
var service: Interaction;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [Interaction,
{
provide: CommandService,
useValue: {}
},
{
provide: PollService,
useValue: {}
}],
}).compile();

service = module.get<Interaction>(Interaction);
});

it('should be defined', () => {
expect(service).toBeDefined();
});
});
Loading

0 comments on commit 68a538d

Please sign in to comment.