-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from codigoencasa/master
stuff
- Loading branch information
Showing
18 changed files
with
8,664 additions
and
250 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,64 @@ | ||
import { ImageResponse } from '@vercel/og'; | ||
export const config = { | ||
runtime: 'edge', | ||
}; | ||
|
||
export default async function handler(request) { | ||
const { searchParams } = new URL(request.url); | ||
const hasTitle = searchParams.has('title'); | ||
const title = hasTitle | ||
? searchParams.get('title')?.slice(0, 100) | ||
: ''; | ||
|
||
const imageData = await fetch(new URL('../../../public/assets/og-image-v4-blank.png', import.meta.url)).then( | ||
(res) => res.arrayBuffer(), | ||
); | ||
|
||
const fontData = await fetch( | ||
new URL('../../../public/fonts/DMSans-SemiBold.ttf', import.meta.url), | ||
).then((res) => res.arrayBuffer()); | ||
|
||
return new ImageResponse( | ||
( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
background: '#f6f6f6', | ||
width: '100%', | ||
height: '100%', | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<img style={{position:'absolute',zIndex:10}} width="1200" height="630" src={imageData} /> | ||
<div style={{ | ||
position:'absolute', | ||
zIndex:99, | ||
right:10, | ||
color:'white', | ||
lineHeight:.8, | ||
textAlign:'center', | ||
display:'flex', | ||
justifyContent:'flex-start', | ||
fontFamily: '"Coolvetica"', | ||
fontSize: 80, | ||
width:680 | ||
}}> | ||
{title} | ||
</div> | ||
</div> | ||
), | ||
{ | ||
width: 1200, | ||
height: 630, | ||
fonts: [ | ||
{ | ||
name: 'Coolvetica', | ||
data: fontData, | ||
style: 'bold', | ||
}, | ||
], | ||
}, | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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,64 @@ | ||
import { Contributors } from '@/components/Contributors' | ||
import { Resources } from '@/components/Resources' | ||
import { Guides } from '@/components/Guides' | ||
|
||
|
||
# Blocked Users on BOT | ||
|
||
To check the blocked users on the BOT, you should use the 'fetchBlocklist()' method of the provider. | ||
This method has the following signature: | ||
|
||
``` | ||
(property) fetchBlocklist: () => Promise<string[]> | ||
``` | ||
|
||
<Contributors mode users={['jorgechavarriaga']} /> | ||
|
||
```ts {{ title: 'app.ts' }} | ||
import { createBot, createProvider, createFlow, addKeyword, EVENTS } from '@builderbot/bot' | ||
import { MemoryDB as Database } from '@builderbot/bot' | ||
import { BaileysProvider as Provider } from '@builderbot/provider-baileys' | ||
import { config } from 'dotenv' | ||
config() | ||
|
||
const PHONE_NUMBER = process.env.PHONE_NUMBER | ||
|
||
const welcomeFlow = addKeyword<Provider, Database>(EVENTS.WELCOME) | ||
.addAnswer(`💡 Example *List Blocked Users on BOT:*`) | ||
.addAction( | ||
async (_, { provider, flowDynamic }) => { | ||
const blocked = await provider.vendor.fetchBlocklist() | ||
const result = blocked.map((id, index) => `id ${index + 1}: ${id}`).join('\n'); | ||
await flowDynamic(`*Blocked:*\n${result}`) | ||
} | ||
) | ||
|
||
const main = async () => { | ||
const adapterFlow = createFlow([welcomeFlow]) | ||
|
||
const adapterProvider = createProvider(Provider, { usePairingCode: true, phoneNumber: PHONE_NUMBER }) | ||
const adapterDB = new Database() | ||
|
||
const botResult = await createBot( | ||
{ | ||
flow: adapterFlow, | ||
provider: adapterProvider, | ||
database: adapterDB, | ||
} | ||
) | ||
} | ||
|
||
main() | ||
|
||
|
||
``` | ||
|
||
<img style={{minHeight:'450px'}} className="rounded-2xl bg-zinc-900 w-full shadow-md dark:ring-1 dark:ring-white/10" src="/assets/examples/blocked_users.png" alt="API Call Example" /> | ||
|
||
|
||
---- | ||
|
||
<Guides /> | ||
|
||
<Resources /> | ||
|
Oops, something went wrong.