Skip to content

Commit

Permalink
remove feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
RishiChaubey31 committed Oct 16, 2024
1 parent 15aa15e commit 18a4359
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
6 changes: 0 additions & 6 deletions src/constants/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ export const MENTION_EACH = {
type: 3,
require: false,
},
{
name: "dev",
description: "want to tag them individually?",
type: 5,
require: false,
},
],
};

Expand Down
9 changes: 4 additions & 5 deletions src/controllers/mentionEachUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { env } from "../typeDefinitions/default.types";
import {
UserArray,
MentionEachUserOptions,
DevFlag,
} from "../typeDefinitions/filterUsersByRole";
import { mentionEachUserInMessage } from "../utils/guildRole";
import { checkDisplayType } from "../utils/checkDisplayType";
Expand All @@ -16,27 +15,27 @@ export async function mentionEachUser(
roleToBeTaggedObj: MentionEachUserOptions;
displayMessageObj?: MentionEachUserOptions;
channelId: number;
dev?: DevFlag;
},
env: env,
ctx: ExecutionContext
) {
const getMembersInServerResponse = await getMembersInServer(env);
const roleId = transformedArgument.roleToBeTaggedObj.value;
const msgToBeSent = transformedArgument?.displayMessageObj?.value;
const dev = transformedArgument?.dev?.value || false;
// optional chaining here only because display message obj is optional argument

const usersWithMatchingRole = filterUserByRoles(
getMembersInServerResponse as UserArray[],
roleId
);

const payload = {
channelId: transformedArgument.channelId,
roleId: roleId,
message: msgToBeSent,
usersWithMatchingRole,
};
if (!dev || usersWithMatchingRole.length === 0) {

if (usersWithMatchingRole.length === 0) {
const responseData = checkDisplayType({
usersWithMatchingRole,
msgToBeSent,
Expand Down
5 changes: 0 additions & 5 deletions src/typeDefinitions/filterUsersByRole.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ export type MentionEachUserOptions = {
type: number;
value: string;
};
export type DevFlag = {
name: string;
type: number;
value: boolean;
};
7 changes: 1 addition & 6 deletions tests/unit/handlers/mentionEachUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Test mention each function", () => {
expect(response).toBeInstanceOf(Promise);
});

it("should run without displayMessageObj argument in dev mode", async () => {
it("should run without displayMessageObj argument", async () => {
const env = {
BOT_PUBLIC_KEY: "xyz",
DISCORD_GUILD_ID: "123",
Expand All @@ -28,11 +28,6 @@ describe("Test mention each function", () => {
const response = mentionEachUser(
{
...onlyRoleToBeTagged,
dev: {
name: "dev",
type: 4,
value: true,
},
},
env,
ctx
Expand Down

0 comments on commit 18a4359

Please sign in to comment.