Skip to content

Conversation

@Darosss
Copy link
Owner

@Darosss Darosss commented Nov 28, 2023

No description provided.

* feat(models/achievements): add showProgress to AchievementModel

* feat(auth/scopes): add new scopes for auth url

- add channel:read:subscriptions
- add bits:read

* feat(defaults/achievements): add new achievements to ACHIEVEMENTS enum

- add SUBSCRIBTIONS_TIER_1, SUBSCRIBTIONS_TIER_2, SUBSCRIBTIONS_TIER_3, SENT_SUBSCRIBTIONS_GIFTS_CUMULATIVE, SENT_SUBSCRIBTIONS_GIFTS_TIER_1, SENT_SUBSCRIBTIONS_GIFTS_TIER_2, SENT_SUBSCRIBTIONS_GIFTS_TIER_3, SENT_SUBSCRIBTIONS_GIFTS_AS_PACK_TIER_1, SENT_SUBSCRIBTIONS_GIFTS_AS_PACK_TIER_2, SENT_SUBSCRIBTIONS_GIFTS_AS_PACK_TIER_3, RECEIVED_SUBSCRIBTIONS_GIFTS, BOUGHT_SUBSCRIBTIONS

* feat(defaults/achievements): add new default achievements

- add new default achievements connected with: 1282a97

* feat(socket/types): add separate types to work with progress achievement

dataTypes:
- rename ObtainAchievementData to ObtainAchievementBaseData
- remove stage from ObtainAchievementBaseData
- add ObtainAchievementDataStageType
- add ObtainAchievementDataProgressDataType
- add ObtainAchievementDataWithCollectedAchievement
- add ObtainAchievementDataWithProgressOnly

clientToServier:
- replace types in emulateAchievement to ObtainAchievementDataWithCollectedAchievement

serverToClient:
- replace types in obtainAchievement to ObtainAchievementDataWithCollectedAchievement | ObtainAchievementDataWithProgressOnly

* feat(socket): add isObtainedAchievement function

* refactor(createUserIfNotExist): change way how get/creatae user

- replace usage of isUserInDB to findneAndUpdate wit option upsert:true
- this change let program to find or create if not exist

* feat(services/achievements): add handling for obtained achievement progresses

types:
- add GainedProgress type
- add gainedProgress to UpdateAchievementUserProgressProgressesReturnData
add UpdateFinishedStagesDependsOnProgressReturnData type

GetDataForObtainAchievementEmitReturnData type:
- change achievement type to  ObtainAchievementBaseData["achievement"]
- change stages type to ObtainAchievementDataWithCollectedAchievement["stage"][]
- add gainedProgress property

achievementUserProgresses:
in updateOneAchievementUserProgress:
- add updateData.progresses.length when no progresses were in doc
in updateFinishedStagesDependsOnProgress:
- destructure achievement and achievementProgress for needed data
- add gainedProgress to returnData
- add else if showProgress is true and stage progress is not finished or it is last index
- add returnData.nowFinishedStages to updateOneAchievementUserProgress
- replace return newfinishedStages; to   return returnData;

in getDataForObtainAchievementEmit:
- add helper getGainedProgressReturnData - to retrieve gained progress data
- add gainedProgress to return data
- destructure foundAchievement to get stageData
- newStages.push - change push type from tuple to object

* feat(EventSubHandler): add new subscriptions + achievement logic

- add achievementsHandler to class property and constructor
methods:
- add subscribeToChannelSubscription
- add subscribeToChannelSubscriptionGift
- add subscribeToChannelFollow

- add above listed into initEvents method

add SubscriptionTiers type

* feat(stream/initializeHandlers): add achievmeentHandler to eventSubHandler opts

* feat(AchievementsHandler): add handling for obtained achievements progress

- add CheckUserSubscribeForAchievementsParams type
- add CheckUserSubscribeGiftsForAchievementsParams type
- add AddAchievementProgressDataToQueueData
- add AddAnonymousAchievementProgressData
- change type of QueueHandler generic to  ObtainAchievementDataWithCollectedAchievement | ObtainAchievementDataWithProgressOnly

methods:
- in startTimeout set timeoutDelat depends if its [...]ObtainedAchievement or [...]ProgressOnly type
in handleDiscordAnnoucment change type of item to ObtainAchievementDataWithCollectedAchievement
- in getDiscordAchievementMessage change type of params to ObtainAchievementDataWithCollectedAchievement
- in enqueue change type of item to ObtainAchievementDataWithCollectedAchievement | ObtainAchievementDataWithProgressOnly
- in updateAchievementUserProgressAndAddToQueue add condition for add achievement progress
- add addAnonymousAchievementProgress method
- add addAchievementProgressDataToQueue

- in addObtainedAchievementDataToQueue add type assertion to enqueu data to ObtainAchievementDataWithCollectedAchievement
- in emitObtainAchievement change emitData to ObtainAchievementDataWithCollectedAchievement | ObtainAchievementDataWithProgressOnly
- in checkUserFollowageForAchievement add 1 minute to twitch follow time, to prevent program gets times like -1
- add checkUserSubscribeForAchievements
- add checkUserSubscribeGiftsForAchievements
* feat(utils/socketData): add isObtainedAchievement function

* refactor(socket): replace to proper types in emulateAchievement emit

* refactor(AchievementStageDisplayData): change to object type in emulateAchievement

* feat(overlay/Achievements): add display achievement progress

- change obtainedAchievement state type to ObtainedAchievementStateType
- change to play sounds with achievement progress or obtained acheivements depends which one is received
- move obtained achievement data into separate component AchievementDataBlock
- create AchievementProgressDataBlock for achievement progresses
@Darosss Darosss merged commit 84abf31 into main Nov 28, 2023
@Darosss Darosss deleted the achievements-progresses-eventsub-subscriptions branch November 28, 2023 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants