Skip to content

Commit

Permalink
upgraded discord notifier to v2 which uses user-created bots
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Oct 3, 2024
1 parent fbbed05 commit 47b3da0
Show file tree
Hide file tree
Showing 14 changed files with 424 additions and 241 deletions.
15 changes: 0 additions & 15 deletions apps/dapp/pages/discord.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions apps/sda/pages/discord.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/i18n/locales/bad/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
"selectWidget": "bad bad",
"setAsProfilePhoto": "bad bad bad bad",
"setDisplayName": "bad bad bad",
"setUpDiscordNotifier": "bad bad bad bad",
"settings": "bad",
"showInstantiateMessage": "bad bad bad",
"showQrCode": "bad bad bad",
Expand Down
24 changes: 20 additions & 4 deletions packages/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
"go": "Go",
"goBack": "Go back",
"goToDaoPage": "Go to DAO page",
"goToDiscordBotRegistration": "Go to Discord Bot Registration",
"goToDiscordDeveloperPortal": "Go to the Discord Developer Portal",
"goToOverruleProposal": "Go to overrule proposal",
"goToProposal": "Go to proposal",
"gotIt": "Got it",
Expand Down Expand Up @@ -212,6 +214,7 @@
"refresh": "Refresh",
"refundAndCancel": "Refund and cancel",
"register": "Register",
"registerDiscordBotWithDaoDao": "Register Discord bot with DAO DAO",
"registerSlashes": "Register slashes",
"registerToVote": "Register to vote",
"registered": "Registered",
Expand All @@ -236,7 +239,7 @@
"selectWidget": "Select widget",
"setAsProfilePhoto": "Set as profile photo",
"setDisplayName": "set display name",
"setUpDiscordNotifier": "Set up Discord Notifier",
"setUpNewNotifier": "Set up new notifier",
"setUpRebalancer": "Set up rebalancer",
"settings": "Settings",
"showInstantiateMessage": "Show Instantiate Message",
Expand Down Expand Up @@ -602,6 +605,7 @@
"baseToken": "Base token",
"becomeSubDaoAdminInputLabel": "New parent DAO",
"blocksToPauseFor": "Blocks to pause for",
"botTokenTooltip": "Find this in the \"Bot\" tab under the \"TOKEN\" heading. Click \"Reset Token\" to generate a new token and view it.",
"buttonLabel": "Button label",
"calls": "Calls",
"callsDescription": "The maximum amount of times the designated account is authorized to call a smart contract.",
Expand Down Expand Up @@ -731,6 +735,8 @@
"noLimit": "No limit",
"noOne": "No one",
"nobody": "Nobody",
"oAuth2ClientIdTooltip": "Find this in the \"OAuth2\" tab under the \"Client information\" heading.",
"oAuth2ClientSecretTooltip": "Find this in the \"OAuth2\" tab under the \"Client information\" heading, next to \"CLIENT ID\". Click \"Reset Secret\" to generate a new secret and view it.",
"oneOneCollection": "1/1 Collection",
"oneOrMoreAccounts": "One or more accounts",
"onlyMembersExecuteDescription": "If enabled, only members may execute passed proposals.",
Expand Down Expand Up @@ -801,6 +807,7 @@
"spendingAllowanceDescription": "The amount of funds allowed to be spent by the authorized account.",
"standardCollection": "Standard Collection",
"startDate": "Start date",
"stepNumber": "Step {{number}}",
"steps": "Steps",
"subDaosToRecognize": "SubDAOs to recognize",
"subDaosToRemove": "SubDAOs to remove",
Expand Down Expand Up @@ -954,6 +961,7 @@
"activeThresholdDescription": "The amount of voting power that needs to be staked in order for the DAO to become active and thus allow proposals to be created.",
"addCw20ToTreasuryActionDescription": "Display the DAO's balance of a CW20 token in the treasury view.",
"addCw721ToTreasuryActionDescription": "Display the NFTs owned by the DAO from a CW721 NFT collection in the treasury view.",
"addDiscordNotifierRedirectInstructions": "In the \"OAuth2\" tab of your Discord application's settings, press the \"Add Redirect\" button under the \"Redirects\" heading. Paste in the URL below, and then click out of the text field. Press the \"Save Changes\" button that appears.",
"addToProfileExplanation": "Add the current chain to your profile shown below.",
"addWalletToProfile": "Add this wallet to your profile.",
"addWalletToProfileToEdit": "You cannot edit your profile until you add the chain your wallet is currently connected to. Click to add it.",
Expand Down Expand Up @@ -1085,9 +1093,12 @@
"direct": "direct",
"disableVetoerDaoDescription": "Stop displaying proposals from a DAO on the home page when they are vetoable.",
"disabled": "Disabled",
"discordNotifierExplanation": "The Discord Notifier broadcasts a message to registered Discord channels when a proposal is created. Clicking the button below begins the registration process; it will take you to Discord's website and prompt you to choose a server and channel. You will then be redirected back here and prompted to authorize with your wallet. Once this is done, proposal notifications are enabled.",
"discordNotifierBeginSetupExplanation": "Click the button below to begin the process of setting up a new notifier.",
"discordNotifierFinishSetupExplanation": "Approve the registration confirmation with your wallet to complete the setup process.",
"discordNotifierRegistrations_one": "You have setup {{count}} notifier.",
"discordNotifierRegistrations_other": "You have setup {{count}} notifiers.",
"discordNotifierSetupExplanation": "Follow the steps below to complete the setup process. Once you complete step 4, you will be redirected back to this page to sign the final confirmation with your wallet.",
"discordNotifierSubtitle": "Broadcast proposal creation notifications to one or more Discord channels.",
"dontKnowNotSure": "Don't know/Not sure",
"draftSavedAtTime": "Draft saved at {{time}}.",
"draftSaving": "Draft saving...",
Expand Down Expand Up @@ -1269,7 +1280,7 @@
"opensAtDate": "Opens at {{date}}",
"optionInert": "This option will not perform any actions if it wins.",
"orSelectWallet": "or select a wallet...",
"otherNotifiersNotShown": "Notifiers setup by others are not shown.",
"otherNotifiersNotShown": "Notifiers set up by others are not shown.",
"overruleSubDaoProposalDescription": "Overrule a proposal in a SubDAO.",
"overwritingSave": "This save will overwrite the existing one with the same name.",
"paid": "Paid",
Expand Down Expand Up @@ -1617,7 +1628,7 @@
"daoCreatedPleaseWait": "DAO created. You will be redirected once the DAO page is ready...",
"deposited": "Deposited {{amount}} ${{tokenSymbol}}.",
"depositedTokenIntoDao": "Deposited {{amount}} ${{tokenSymbol}} into the {{daoName}} treasury.",
"discordNotifierEnabled": "Discord notifier setup successfully. Your notifier list will be updated shortly.",
"discordNotifierEnabled": "Discord notifier set up successfully. Your notifier list will be updated shortly.",
"discordNotifierRemoved": "Discord notifier removed. Your notifier list will be updated shortly.",
"multisigImported": "Import successful. Review your new DAO's configuration, and make sure to set an image, name, and description.",
"nftCollectionContractInstantiated": "NFT collection created successfully.",
Expand Down Expand Up @@ -1659,8 +1670,10 @@
"actions_other": "Actions",
"active": "Active",
"activeThreshold": "Active threshold",
"addBotToServer": "Add bot to server",
"addCw20ToTreasury": "Display Token Balance in Treasury",
"addCw721ToTreasury": "Display NFT Collection in Treasury",
"addRedirect": "Add redirect",
"addToProfile": "Add to Profile",
"advancedConfiguration": "Advanced configuration",
"all": "All",
Expand Down Expand Up @@ -1725,11 +1738,13 @@
"continuous": "Continuous",
"contributions": "Contributions",
"contributor": "Contributor",
"copyAppDetails": "Copy app details",
"createADAO": "Create a DAO",
"createAProposal": "Create a proposal",
"createASubDao": "Create a SubDAO",
"createCrossChainAccount": "Create Cross-Chain Account",
"createDao": "Create DAO",
"createDiscordApplication": "Create Discord application",
"createIca": "Create ICA",
"createNftCollection": "Create NFT Collection",
"createPost": "Create Post",
Expand Down Expand Up @@ -1798,6 +1813,7 @@
"fees": "Fees",
"fiatOnOffRamp": "Fiat on/off ramp",
"filter": "Filter",
"finishSetup": "Finish setup",
"finished": "Finished",
"fixChildAdmin": "Fix {{child}} admin",
"following": "Following",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
"selectWidget": "Seleccionar widget",
"setAsProfilePhoto": "Establecer como foto de perfil",
"setDisplayName": "Establecer nombre para mostrar",
"setUpDiscordNotifier": "Configurar notificador de Discord",
"setUpRebalancer": "Configurar reequilibrador",
"settings": "Configuración",
"shareFeedback": "Compartir retroalimentación",
Expand Down
19 changes: 13 additions & 6 deletions packages/state/recoil/atoms/dao.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { atom } from 'recoil'
import { atom, atomFamily } from 'recoil'

import { localStorageEffectJSON } from '../effects'

Expand All @@ -21,11 +21,18 @@ export const temporaryFollowingDaosAtom = atom<{
default: { following: [], unfollowing: [] },
})

export const discordNotifierSetupAtom = atom<{
state: string
coreAddress: string
} | null>({
export const discordNotifierSetupAtom = atomFamily<
| {
state: string
clientId: string
clientSecret: string
botToken: string
redirectUri: string
}
| undefined,
string
>({
key: 'discordNotifierSetup',
default: null,
default: undefined,
effects: [localStorageEffectJSON],
})
4 changes: 2 additions & 2 deletions packages/state/recoil/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export const localStorageEffect =
}

const savedValue = localStorage.getItem(key)
if (savedValue !== null) {
if (savedValue && savedValue !== 'undefined') {
setSelf(parse(savedValue))
}

onSet((newValue: T, _: any, isReset: boolean) => {
if (isReset) {
if (isReset || newValue === undefined) {
localStorage.removeItem(key)
} else {
localStorage.setItem(key, serialize(newValue))
Expand Down
56 changes: 0 additions & 56 deletions packages/stateful/components/DiscordRedirect.tsx

This file was deleted.

Loading

0 comments on commit 47b3da0

Please sign in to comment.