Skip to content

A snippet pack to make you more productive working with Telegraf.js

License

Notifications You must be signed in to change notification settings

gramlify/telegraf-snipgram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegraf Snipgram

Download this extension from the Visual Studio Code Marketplace

Usage

Here's the full list of all the snippets:

[tfs] Telegraf Starter

const { Telegraf } = require("telegraf");

const app = new Telegraf();

app.launch();

process.once("SIGINT", () => app.stop("SIGINT"));
process.once("SIGTERM", () => app.stop("SIGTERM"));

[tfsm] Telegraf Starter ESM

import { Telegraf } from "telegraf";

const app = new Telegraf();

app.launch();

process.once("SIGINT", () => app.stop("SIGINT"));
process.once("SIGTERM", () => app.stop("SIGTERM"));

[tfc] Telegraf Command

app.command("", (ctx) => {
  // your code here
});

[tfca] Telegraf Command Asynchronous

app.command("", async (ctx) => {
  // your code here
});

[tfn] Telegraf On Something

app.on("", (ctx) => {
  // your code here
});

[tfna] Telegraf On Something Asynchronous

app.on("", async (ctx) => {
  // your code here
});

[tfntxt] Telegraf On Text

app.on("text", (ctx) => {
  // your code here
});

[tfntxta] Telegraf On Text Asynchronous

app.on("text", async (ctx) => {
  // your code here
});

[tfncq] Telegraf On Callback Query

app.on("callback_query", (ctx) => {
  // your code here
});

[tfncqa] Telegraf On Callback Query Asynchronous

app.on("callback_query", async (ctx) => {
  // your code here
});

[tfniq] Telegraf On Inline Query

app.on("inline_query", (ctx) => {
  // your code here
});

[tfniqa] Telegraf On Inline Query Asynchronous

app.on("inline_query", async (ctx) => {
  // your code here
});

[tfbs] Telegraf Base Scene

const someScene = new Scenes.BaseScene<Scenes.SceneContext>("some");
someScene.enter((ctx) => {
  // your code here
});

[tfbsa] Telegraf Base Scene Asynchronous

const someScene = new Scenes.BaseScene<Scenes.SceneContext>("some");
someScene.enter(async (ctx) => {
  // your code here
});

[tfsbs] Telegraf Stage Base Scene

const stage = new Scenes.Stage<Scenes.SceneContext>([]);

[tfsbst] Telegraf Stage Base Scene With TTL

const stage = new Scenes.Stage<Scenes.SceneContext>([], {
  ttl: 10,
});

[tfws] Telegraf Wizard Scene

const someWizard = new Scenes.WizardScene(
  "some-wizard",
  (ctx) => {
    // your code here
  }
);

[tfwsa] Telegraf Wizard Scene Asynchronous

const someWizard = new Scenes.WizardScene(
  "some-wizard",
  async (ctx) => {
    // your code here
  }
);

[tfsws] Telegraf Stage Wizard Scene

const stage = new Scenes.Stage<Scenes.WizardContext>([], {
  default: "-wizard",
});

[tfwsrn] Telegraf Return Wizard Scene Next

return ctx.wizard.next();

[tc] [tfctx] Telegraf CTX

(ctx) => {
  // your code here
};

[tca] [tfctxa] Telegraf CTX Asynchronous

async (ctx) => {
  // your code here
};

About

A snippet pack to make you more productive working with Telegraf.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published