diff --git a/404.html b/404.html index c9fbafb..284b14c 100644 --- a/404.html +++ b/404.html @@ -14,7 +14,7 @@ - +
diff --git a/__docusaurus/debug.html b/__docusaurus/debug.html index 178a363..3ee5029 100644 --- a/__docusaurus/debug.html +++ b/__docusaurus/debug.html @@ -14,7 +14,7 @@ - + diff --git a/__docusaurus/debug/config.html b/__docusaurus/debug/config.html index 8f12791..64c1e8a 100644 --- a/__docusaurus/debug/config.html +++ b/__docusaurus/debug/config.html @@ -14,7 +14,7 @@ - + diff --git a/__docusaurus/debug/content.html b/__docusaurus/debug/content.html index d907bfd..36fa0dd 100644 --- a/__docusaurus/debug/content.html +++ b/__docusaurus/debug/content.html @@ -14,7 +14,7 @@ - + diff --git a/__docusaurus/debug/globalData.html b/__docusaurus/debug/globalData.html index 7640b34..37e399b 100644 --- a/__docusaurus/debug/globalData.html +++ b/__docusaurus/debug/globalData.html @@ -14,7 +14,7 @@ - + diff --git a/__docusaurus/debug/metadata.html b/__docusaurus/debug/metadata.html index a0846c2..ecacdf1 100644 --- a/__docusaurus/debug/metadata.html +++ b/__docusaurus/debug/metadata.html @@ -14,7 +14,7 @@ - + diff --git a/__docusaurus/debug/registry.html b/__docusaurus/debug/registry.html index be67073..d03a61c 100644 --- a/__docusaurus/debug/registry.html +++ b/__docusaurus/debug/registry.html @@ -14,7 +14,7 @@ - + diff --git a/__docusaurus/debug/routes.html b/__docusaurus/debug/routes.html index 8b3958a..1f5b982 100644 --- a/__docusaurus/debug/routes.html +++ b/__docusaurus/debug/routes.html @@ -14,7 +14,7 @@ - + diff --git a/assets/js/56b0b38a.d1d3b8e4.js b/assets/js/56b0b38a.e33a4d10.js similarity index 63% rename from assets/js/56b0b38a.d1d3b8e4.js rename to assets/js/56b0b38a.e33a4d10.js index 223dcbf..9e79bf1 100644 --- a/assets/js/56b0b38a.d1d3b8e4.js +++ b/assets/js/56b0b38a.e33a4d10.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[356],{308:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>r,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var o=n(6106),s=n(9252);const a={id:"message-interactions",title:"Message Interactions",sidebar_position:3},r=void 0,i={id:"interactions/message-interactions",title:"Message Interactions",description:"Message interactions \u2014 we'll call them \"interaction\" moving forward\u2014are a framework for adding interactive elements to the messages your app or bot sends. They're accessible, customizable, and easy to use.",source:"@site/content/interactions/interaction-components.md",sourceDirName:"interactions",slug:"/interactions/message-interactions",permalink:"/interactions/message-interactions",draft:!1,unlisted:!1,editUrl:"https://github.com/GlobalArtInc/nestgram/tree/master/docs/content/interactions/interaction-components.md",tags:[],version:"current",sidebarPosition:3,frontMatter:{id:"message-interactions",title:"Message Interactions",sidebar_position:3},sidebar:"docsSidebar",previous:{title:"Introduction",permalink:"/"},next:{title:"Text Commands",permalink:"/text-commands"}},c={},l=[{value:"Button",id:"button",level:2}];function m(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"Message interactions"})," \u2014 we'll call them \"interaction\" moving forward\u2014are a framework for adding interactive elements to the messages your app or bot sends. They're accessible, customizable, and easy to use."]}),"\n",(0,o.jsx)(t.p,{children:"There are several different types of interactions; this documentation will outline the basics of this new framework and each example."}),"\n",(0,o.jsx)(t.h2,{id:"button",children:"Button"}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"Buttons"})," are interactive components that render on messages. They can be clicked by users, and send an interaction to your app when clicked."]}),"\n",(0,o.jsx)("img",{src:"/img/content/button.jpg",alt:"Buttons",width:"500"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-typescript",metastring:'title="src/app.components.ts"',children:"import { Injectable } from '@nestjs/common';\nimport { Context, Button, ButtonContext, ComponentParam, On, TextCommandContext } from '@globalart/nestcord';\nimport { Markup, Telegraf } from 'telegraf';\n\n@Injectable()\nexport class AppService {\n constructor(private readonly client: Telegraf) {\n\n }\n getHello(): string {\n return 'Hello World!';\n }\n\n @TextCommand({\n name: 'start',\n description: 'Displays this help message.',\n })\n onStart(@Context() [ctx]: TextCommandContext) {\n const inlineKeyboard = Markup.inlineKeyboard([\n {\n text: 'Button 1',\n callback_data: 'nestgram/button1',\n },\n {\n text: 'Button 2',\n callback_data: 'nestgram/button2',\n },\n ])\n\n ctx.reply('Start message', inlineKeyboard);\n }\n\n @Button('nestgram/:name')\n async handleClickButton(@Context() ctx: ButtonContext, @ComponentParam('name') name: string) {\n await ctx.reply(`clicked on ${name}`);\n }\n}\n"})})]})}function d(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},9252:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>i});var o=n(7378);const s={},a=o.createContext(s);function r(e){const t=o.useContext(a);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),o.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[356],{308:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>r,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var o=n(6106),s=n(9252);const a={id:"message-interactions",title:"Message Interactions",sidebar_position:3},r=void 0,i={id:"interactions/message-interactions",title:"Message Interactions",description:"Message interactions \u2014 we'll call them \"interaction\" moving forward\u2014are a framework for adding interactive elements to the messages your app or bot sends. They're accessible, customizable, and easy to use.",source:"@site/content/interactions/interaction-components.md",sourceDirName:"interactions",slug:"/interactions/message-interactions",permalink:"/interactions/message-interactions",draft:!1,unlisted:!1,editUrl:"https://github.com/GlobalArtInc/nestgram/tree/master/docs/content/interactions/interaction-components.md",tags:[],version:"current",sidebarPosition:3,frontMatter:{id:"message-interactions",title:"Message Interactions",sidebar_position:3},sidebar:"docsSidebar",previous:{title:"Introduction",permalink:"/"},next:{title:"Text Commands",permalink:"/text-commands"}},c={},l=[{value:"Button",id:"button",level:2}];function m(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"Message interactions"})," \u2014 we'll call them \"interaction\" moving forward\u2014are a framework for adding interactive elements to the messages your app or bot sends. They're accessible, customizable, and easy to use."]}),"\n",(0,o.jsx)(t.p,{children:"There are several different types of interactions; this documentation will outline the basics of this new framework and each example."}),"\n",(0,o.jsx)(t.h2,{id:"button",children:"Button"}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"Buttons"})," are interactive components that render on messages. They can be clicked by users, and send an interaction to your app when clicked."]}),"\n",(0,o.jsx)("img",{src:"/img/content/button.jpg",alt:"Buttons",width:"500"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-typescript",metastring:'title="src/app.components.ts"',children:"import { Injectable } from '@nestjs/common';\nimport { Context, Button, ButtonContext, ComponentParam, On, TextCommandContext } from '@nestgramjs/core';\nimport { Markup, Telegraf } from 'telegraf';\n\n@Injectable()\nexport class AppService {\n constructor(private readonly client: Telegraf) {\n\n }\n getHello(): string {\n return 'Hello World!';\n }\n\n @TextCommand({\n name: 'start',\n description: 'Displays this help message.',\n })\n onStart(@Context() [ctx]: TextCommandContext) {\n const inlineKeyboard = Markup.inlineKeyboard([\n {\n text: 'Button 1',\n callback_data: 'nestgram/button1',\n },\n {\n text: 'Button 2',\n callback_data: 'nestgram/button2',\n },\n ])\n\n ctx.reply('Start message', inlineKeyboard);\n }\n\n @Button('nestgram/:name')\n async handleClickButton(@Context() ctx: ButtonContext, @ComponentParam('name') name: string) {\n await ctx.reply(`clicked on ${name}`);\n }\n}\n"})})]})}function d(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},9252:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>i});var o=n(7378);const s={},a=o.createContext(s);function r(e){const t=o.useContext(a);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),o.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.87f217f1.js b/assets/js/runtime~main.09f9b340.js similarity index 98% rename from assets/js/runtime~main.87f217f1.js rename to assets/js/runtime~main.09f9b340.js index e53401a..f3861db 100644 --- a/assets/js/runtime~main.87f217f1.js +++ b/assets/js/runtime~main.09f9b340.js @@ -1 +1 @@ -(()=>{"use strict";var e,t,a,r,o,n={},f={};function d(e){var t=f[e];if(void 0!==t)return t.exports;var a=f[e]={id:e,loaded:!1,exports:{}};return n[e].call(a.exports,a,a.exports,d),a.loaded=!0,a.exports}d.m=n,d.c=f,e=[],d.O=(t,a,r,o)=>{if(!a){var n=1/0;for(i=0;iButtons are interactive components that render on messages. They can be clicked by users, and send an interaction to your app when clicked.
-import { Injectable } from '@nestjs/common';
import { Context, Button, ButtonContext, ComponentParam, On, TextCommandContext } from '@globalart/nestcord';
import { Markup, Telegraf } from 'telegraf';
@Injectable()
export class AppService {
constructor(private readonly client: Telegraf) {
}
getHello(): string {
return 'Hello World!';
}
@TextCommand({
name: 'start',
description: 'Displays this help message.',
})
onStart(@Context() [ctx]: TextCommandContext) {
const inlineKeyboard = Markup.inlineKeyboard([
{
text: 'Button 1',
callback_data: 'nestgram/button1',
},
{
text: 'Button 2',
callback_data: 'nestgram/button2',
},
])
ctx.reply('Start message', inlineKeyboard);
}
@Button('nestgram/:name')
async handleClickButton(@Context() ctx: ButtonContext, @ComponentParam('name') name: string) {
await ctx.reply(`clicked on ${name}`);
}
}
import { Injectable } from '@nestjs/common';
import { Context, Button, ButtonContext, ComponentParam, On, TextCommandContext } from '@nestgramjs/core';
import { Markup, Telegraf } from 'telegraf';
@Injectable()
export class AppService {
constructor(private readonly client: Telegraf) {
}
getHello(): string {
return 'Hello World!';
}
@TextCommand({
name: 'start',
description: 'Displays this help message.',
})
onStart(@Context() [ctx]: TextCommandContext) {
const inlineKeyboard = Markup.inlineKeyboard([
{
text: 'Button 1',
callback_data: 'nestgram/button1',
},
{
text: 'Button 2',
callback_data: 'nestgram/button2',
},
])
ctx.reply('Start message', inlineKeyboard);
}
@Button('nestgram/:name')
async handleClickButton(@Context() ctx: ButtonContext, @ComponentParam('name') name: string) {
await ctx.reply(`clicked on ${name}`);
}
}