Skip to content

Commit

Permalink
Merge pull request #4 from BanklessDAO/fix/validateL2AboveMembers
Browse files Browse the repository at this point in the history
fix /command permission validation error and update package.json
  • Loading branch information
SlinkyPotato authored Jan 19, 2022
2 parents 56fa87d + c251374 commit 10d9043
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "first-quest-bot",
"version": "1.0.0",
"description": "description here",
"description": "First Quest and CAPTCHA verification for Bankless DAO.",
"main": "app.js",
"private": true,
"scripts": {
Expand All @@ -18,7 +18,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/BanklessDAO/degen-bankless-dao"
"url": "git+https://github.com/BanklessDAO/first-quest-bot"
},
"keywords": [
"bankless",
Expand All @@ -27,11 +27,11 @@
"crypto"
],
"author": "BANKLESS DAO",
"license": "BUSL-1.1",
"license": "MIT",
"bugs": {
"url": "https://github.com/BanklessDAO/degen-bankless-dao/issues"
"url": "https://github.com/BanklessDAO/first-quest-bot/issues"
},
"homepage": "https://github.com/BanklessDAO/degen-bankless-dao/main/README.md",
"homepage": "https://github.com/BanklessDAO/first-quest-bot/main/README.md",
"dependencies": {
"@logdna/logger": "^2.4.1",
"@notionhq/client": "0.2.0",
Expand Down Expand Up @@ -65,14 +65,13 @@
"jest": "^27.0.6",
"ts-jest": "^27.0.5",
"ts-loader": "^9.2.3",
"typescript": "~4.4.3"
"typescript": "4.4.3",
"webpack": "^5.44.0",
"webpack-cli": "^4.7.2"
},
"engines": {
"yarn": "1.x",
"node": "16.x"
},
"engineStrict": true,
"directories": {
"doc": "docs"
}
"engineStrict": true
}
11 changes: 9 additions & 2 deletions src/app/service/first-quest/ConfigureFirstQuest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import { Db, ObjectID } from 'mongodb';
import dbInstance from '../../utils/MongoDbUtils';
import constants from '../constants/constants';
import fqConstants from '../constants/firstQuest';
import Log from '../../utils/Log';
import Log, { LogUtils } from '../../utils/Log';
import channelIds from '../constants/channelIds';
import roleIds from '../constants/roleIds';
import ServiceUtils from '../../utils/ServiceUtils';
import { CommandContext } from 'slash-create';

export default async (member: GuildMember, ctx: CommandContext): Promise<any> => {
ServiceUtils.validateLevel2AboveMembers(member);
try {
ServiceUtils.validateLevel2AboveMembers(member);
} catch (e) {
LogUtils.logError('L2 validation failed', e);
ctx?.send(`Hi, ${ctx.user.mention}! You do not have permission to use this command.`);
return;
}

await ctx?.send(`Hi, ${ctx.user.mention}! I sent you a DM with more information.`);

const dmChannel = await member.user.createDM();
Expand Down
8 changes: 7 additions & 1 deletion src/app/service/first-quest/FirstQuestPOAP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ import channelIds from '../constants/channelIds';
import client from '../../app';

export default async (guildMember: GuildMember, ctx: CommandContext): Promise<any> => {
ServiceUtils.validateLevel2AboveMembers(guildMember);
try {
ServiceUtils.validateLevel2AboveMembers(guildMember);
} catch (e) {
LogUtils.logError('L2 validation failed', e);
ctx?.send(`Hi, ${ctx.user.mention}! You do not have permission to use this command.`);
return;
}

await ctx?.send(`Hi, ${ctx.user.mention}! I sent you a DM with more information.`);

Expand Down

0 comments on commit 10d9043

Please sign in to comment.