-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : Added the feature of sending notification to discord for any n…
…ew video/notion
- Loading branch information
1 parent
7232c99
commit 499d178
Showing
9 changed files
with
189 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,6 @@ BOT_TOKEN = "123" | |
GUILD_ID = "123" | ||
LOCAL_CMS_PROVIDER = true | ||
CACHE_EXPIRE_S = 10 | ||
|
||
ADMINS = "Random,[email protected]" | ||
NEXT_PUBLIC_DISABLE_FEATURES = "featurea,featureb,featurec" | ||
NEXT_PUBLIC_DISCORD_WEBHOOK_URL="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import axios from 'axios'; | ||
|
||
interface DiscordData { | ||
type: string; | ||
thumbnail: string; | ||
title: string; | ||
courseTitle: string; | ||
courseId: number; | ||
mediaId: number; | ||
currFolderId: number; | ||
} | ||
|
||
export default function DiscordService() { | ||
const sendUpdateToDiscord = async (data: DiscordData) => { | ||
const body = { | ||
content: 'Hello @everyone', | ||
tts: false, | ||
color: 'white', | ||
embeds: [ | ||
{ | ||
title: `New ${data?.type === 'notion' ? 'NOTE' : data?.type?.toUpperCase()}`, | ||
description: `${data?.title} has been added in the ${data?.courseTitle} , [Click here to visit this ${data?.type === 'notion' ? 'note' : data?.type}](https://app.100xdevs.com/courses/${data.courseId}/${data.currFolderId}/${data.mediaId})`, | ||
}, | ||
], | ||
}; | ||
|
||
try { | ||
const res = await axios.post( | ||
`${process.env.NEXT_PUBLIC_DISCORD_WEBHOOK_URL}`, | ||
body, | ||
); | ||
console.log(res); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; | ||
return { | ||
sendUpdateToDiscord, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use client'; | ||
|
||
import * as React from 'react'; | ||
import * as CheckboxPrimitive from '@radix-ui/react-checkbox'; | ||
import { Check } from 'lucide-react'; | ||
|
||
import { cn } from '@/lib/utils'; | ||
|
||
const Checkbox = React.forwardRef< | ||
React.ElementRef<typeof CheckboxPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> | ||
>(({ className, ...props }, ref) => ( | ||
<CheckboxPrimitive.Root | ||
ref={ref} | ||
className={cn( | ||
'peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground', | ||
className, | ||
)} | ||
{...props} | ||
> | ||
<CheckboxPrimitive.Indicator | ||
className={cn('flex items-center justify-center text-current')} | ||
> | ||
<Check className="h-4 w-4" /> | ||
</CheckboxPrimitive.Indicator> | ||
</CheckboxPrimitive.Root> | ||
)); | ||
Checkbox.displayName = CheckboxPrimitive.Root.displayName; | ||
|
||
export { Checkbox }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { atom } from 'recoil'; | ||
|
||
export const loader = atom({ | ||
key: 'loader', | ||
default: false, | ||
}); |