Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #296 from BanklessDAO/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SlinkyPotato authored Jan 12, 2022
2 parents d169800 + a93516d commit dacc02d
Show file tree
Hide file tree
Showing 27 changed files with 415 additions and 261 deletions.
7 changes: 1 addition & 6 deletions .env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,13 @@ DISCORD_CHANNEL_DEV_WORKROOM_ID=841349002330505266
DISCORD_CHANNEL_WRITERS_ROOM_ID=841332222946312232

# Logger
LOGDNA_APP_NAME=degen-tbd
LOGDNA_APP_NAME=degen
LOGDNA_DEFAULT_LEVEL=info

# POAP
POAP_REQUIRED_PARTICIPATION_DURATION=10
POAP_MAX_EVENT_DURATION_MINUTES=180

# MISC
DAO_CURRENT_SEASON=2
DAO_CURRENT_SEASON_END_DATE=2022-01-07T04:00:00.000Z
DAO_GUEST_PASS_EXPIRATION_DAYS=14

# Twitter
TWITTER_API_TOKEN=
TWITTER_API_SECRET=
Expand Down
8 changes: 0 additions & 8 deletions .env.qa
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,10 @@ DISCORD_CHANNEL_FIRST_QUEST_PROJECT_ID=854401837566001192
LOGDNA_APP_NAME=serendipity-mk1
LOGDNA_DEFAULT_LEVEL=debug

# MISC
DAO_CURRENT_SEASON=2
DAO_CURRENT_SEASON_END_DATE=2022-01-07T04:00:00.000Z
DAO_GUEST_PASS_EXPIRATION_DAYS=14

# POAP
POAP_REQUIRED_PARTICIPATION_DURATION=10
POAP_MAX_EVENT_DURATION_MINUTES=180

# URLs
DAO_BOUNTY_BOARD_URL=https://develop--bounty-board-29081e.netlify.app/

# Twitter
TWITTER_API_TOKEN=
TWITTER_API_SECRET=
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,17 @@ jobs:
HD_POAP_CLIENT_ID: ${{secrets.PROD_POAP_CLIENT_ID}}
HD_POAP_CLIENT_SECRET: ${{secrets.PROD_POAP_CLIENT_SECRET}}
HD_SENTRY_IO_DSN: ${{secrets.PROD_SENTRY_IO_DSN}}
- name: Get current package version
id: package-version
uses: martinbeentjes/[email protected]
- name: Sentry Release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
sourcemaps: './dist'
with:
environment: 'production'
version: 'degen@${{ steps.package-version.outputs.current-version }}'
sourcemaps: './dist'
19 changes: 16 additions & 3 deletions .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ jobs:
HD_LOGDNA_TOKEN: ${{secrets.QA_LOGDNA_TOKEN}}
HD_TWITTER_API_TOKEN: ${{secrets.QA_TWITTER_API_TOKEN}}
HD_TWITTER_API_SECRET: ${{secrets.QA_TWITTER_API_SECRET}}
HD_TWITTER_BEARER_TOKEN: ${{secrets.QA_TWITTER_API_BEARER_TOKEN}}
HD_TWITTER_ACCESS_TOKEN_SECRET: ${{secrets.QA_TWITTER_API_ACCESS_TOKEN_SECRET}}
HD_SENTRY_IO_DSN: ${{secrets.QA_SENTRY_IO_DSN}}
HD_TWITTER_BEARER_TOKEN: ${{secrets.QA_TWITTER_BEARER_TOKEN}}
HD_TWITTER_ACCESS_TOKEN_SECRET: ${{secrets.QA_TWITTER_ACCESS_TOKEN_SECRET}}
HD_SENTRY_IO_DSN: ${{secrets.QA_SENTRY_IO_DSN}}
- name: Get current package version
id: package-version
uses: martinbeentjes/[email protected]
- name: Sentry Release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: 'qa'
version: 'degen@${{ steps.package-version.outputs.current-version }}'
sourcemaps: './dist'
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Changelog

## 2.5.2-RELEASE
## 2.6.0-RELEASE (2022-01-11)

1. Stability check
- add sentry github action
- fix poap mint api call
- fix auto end for DM event
- fix gm regex for single line
- refactor poap start/stop tracking event
2. Twitter stability check
- handle timeout for autoend situation
- better error messaging
- stability enhancements
- add forced start script
3. Fix key github action reference for twitter spaces
- remove extra logging
- send twitter auth confirmation only on direct auth flow

## 2.5.2-RELEASE (2022-01-09)

1. Address sentry.io issues 2022-01-08
- add type guards to messageCreate sentry method
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "degen-tbd",
"version": "2.5.2",
"name": "degen",
"version": "2.6.0",
"description": "Administrative and Utilitarian bot for the Bankless Discord Server.",
"main": "app.js",
"private": true,
Expand All @@ -9,9 +9,10 @@
"test": "jest",
"qa": "node -r dotenv/config --trace-warnings dist/app/app.js dotenv_config_path=.env.qa",
"prod": "node -r dotenv/config --trace-warnings dist/app/app.js dotenv_config_path=.env.prod",
"prestart": "yarn install && yarn build",
"prestart": "yarn install && yarn build && yarn lint",
"pretest": "yarn install && yarn build",
"start": "node --trace-warnings -r dotenv/config dist/app/app.js",
"force-start": "tsc -p tsconfig.json && node -r dotenv/config dist/app/app.js",
"lint": "eslint . --ext .ts",
"format": "eslint . --ext .ts --fix",
"watch": "tsc -p tsconfig.json -w"
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/poap/EventsAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const EventsAPI = {
start_date: `${request.start_date}`,
end_date: `${request.end_date}`,
expiry_date: `${request.expiry_date}`,
year: `${request.year}`,
year: request.year,
event_url: `${request.event_url}`,
virtual_event: `${request.virtual_event}`,
secret_code: `${request.secret_code}`,
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/types/poap-events/EventsRequestType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type EventsRequestType = {
start_date: string,
end_date: string,
expiry_date: string,
year: string,
year: number,
event_url?: string,
virtual_event: boolean,
image: AxiosResponse,
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function initializeSentryIO() {
dsn: `${apiKeys.sentryDSN}`,
tracesSampleRate: 1.0,
release: `${constants.APP_NAME}@${constants.APP_VERSION}`,
environment: process.env.SENTRY_ENVIRONMENT,
environment: `${process.env.SENTRY_ENVIRONMENT}`,
integrations: [
new RewriteFrames({
root: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion src/app/commands/admin/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class Account extends SlashCommand {

const { guildMember } = await ServiceUtils.getGuildAndMember(ctx.guildID, ctx.user.id);
try {
await VerifyTwitter(ctx, guildMember).catch(e => { throw e; });
await VerifyTwitter(ctx, guildMember, true).catch(e => { throw e; });
} catch (e) {
if (e instanceof ValidationError) {
await ctx.send({ content: `${e.message}`, ephemeral: true });
Expand Down
5 changes: 3 additions & 2 deletions src/app/events/Ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export default class implements DiscordEvent {
}
const db = await MongoDbUtils.connect(constants.DB_NAME_DEGEN);
await updateActiveDiscordServers(client, db);
await POAPService.runAutoEndSetup(client, constants.PLATFORM_TYPE_DISCORD).catch(Log.error);
await POAPService.runAutoEndSetup(client, constants.PLATFORM_TYPE_TWITTER).catch(Log.error);
// should not wait
POAPService.runAutoEndSetup(client, constants.PLATFORM_TYPE_DISCORD).catch(Log.error);
POAPService.runAutoEndSetup(client, constants.PLATFORM_TYPE_TWITTER).catch(Log.error);
await POAPService.clearExpiredPOAPs();

Log.info(`${constants.APP_NAME} is ready!`);
Expand Down
4 changes: 2 additions & 2 deletions src/app/events/VoiceStateUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { VoiceState } from 'discord.js';
import addUserForEvent from './poap/AddUserForEvent';
import { DiscordEvent } from '../types/discord/DiscordEvent';
import { LogUtils } from '../utils/Log';
import HandleParticipantDuringEvent from './poap/HandleParticipantDuringEvent';

/**
* voiceStateUpdate
Expand All @@ -18,7 +18,7 @@ export default class implements DiscordEvent {
*/
async execute(oldState: VoiceState, newState: VoiceState): Promise<any> {
try {
await addUserForEvent(oldState, newState).catch(e => LogUtils.logError('failed to add user for POAP event', e, oldState.guild.id));
await HandleParticipantDuringEvent(oldState, newState).catch(e => LogUtils.logError('failed to handle user in POAP event', e, oldState.guild.id));
} catch (e) {
LogUtils.logError('failed to process event voiceStateUpdate', e);
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/events/chat/HandlePOAPGM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ const HandlePOAPGM = async (message: Message): Promise<void> => {
return;
}

if (!content.match(/gm/gi)) {
if (!content.match(/^gm$/gi)) {
return;
}

Log.debug(`found gm from ${message.author.tag}`);

const dmChannel: DMChannel = message.channel as DMChannel;
Expand Down
128 changes: 0 additions & 128 deletions src/app/events/poap/AddUserForEvent.ts

This file was deleted.

Loading

0 comments on commit dacc02d

Please sign in to comment.