Skip to content

Commit

Permalink
fix: remove useless option prop
Browse files Browse the repository at this point in the history
breaking changes: useInteraction is dropped
  • Loading branch information
HunteRoi committed Nov 15, 2022
1 parent 92eb5f2 commit 8a02a58
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 31 deletions.
4 changes: 1 addition & 3 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ const {
const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.DirectMessages,
IntentsBitField.Flags.GuildMessages,
],
partials: [Partials.Message],
]
});
synchronizeSlashCommands(
client,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hunteroi/discord-verification",
"version": "1.1.0",
"version": "1.1.1",
"description": "A framework to integrate a verification system with your Discord guild built with DiscordJS",
"main": "lib/index.js",
"scripts": {
Expand Down
24 changes: 1 addition & 23 deletions src/VerificationManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, IntentsBitField, Snowflake, Partials } from 'discord.js';
import { Client, Snowflake } from 'discord.js';
import EventEmitter from 'events';

import { CodeGeneratorService } from './services';
Expand All @@ -24,7 +24,6 @@ export class VerificationManager<TUser extends IUser> extends EventEmitter {
storingSystem: IStoringSystem<TUser>,
senderAPI: ISenderAPI,
options: VerificationOptions<TUser> = {
useInteraction: true,
codeGenerationOptions: {
length: 6,
},
Expand All @@ -48,27 +47,6 @@ export class VerificationManager<TUser extends IUser> extends EventEmitter {
if (!senderAPI) throw 'SenderAPI is required';
this.validateOptions(options);

const intents = new IntentsBitField(client.options.intents);
if (!intents.has(IntentsBitField.Flags.Guilds)) {
throw 'GUILDS intent is required to use this package!';
}

if (options.usePrivateMessages) {
if (!intents.has(IntentsBitField.Flags.DirectMessages)) {
throw 'DIRECT_MESSAGES intent is required to use this package!';
}
if (
!this.client.options.partials.includes(Partials.Message)
) {
throw 'MESSAGE partial is required to use this package with DM!';
}
} else if (
!options.useInteraction &&
!intents.has(IntentsBitField.Flags.GuildMessages)
) {
throw 'GUILD_MESSAGES intent is required to use this package!';
}

this.client = client;
this.options = options;
this.storingSystem = storingSystem;
Expand Down
4 changes: 0 additions & 4 deletions src/types/VerificationOptions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { IUser } from '.';

export interface VerificationOptions<TUser extends IUser> {
useInteraction: boolean;

usePrivateMessages?: boolean;

codeGenerationOptions: {
charactersWhitelist?: string;
length: number;
Expand Down

0 comments on commit 8a02a58

Please sign in to comment.