@grammyjs/emoji
Advanced tools
Comparing version 1.1.0 to 1.2.0
export * from "grammy"; | ||
export type { Message } from "@grammyjs/types"; |
import { Context, NextFunction } from "./deps.node.js"; | ||
import type { EmojiName } from "./emoji.js"; | ||
export declare type EmojiFlavor<C extends Context = Context> = C & { | ||
import emojis from "./emojidata.js"; | ||
type EmojiList = typeof emojis; | ||
type EmojiName = keyof EmojiList | (string & Record<never, never>); | ||
export type EmojiFlavor<C extends Context = Context> = C & { | ||
/** | ||
@@ -27,5 +29,6 @@ * You can use this method to parse a string with emojis. | ||
*/ | ||
replyWithEmoji: (string: TemplateStringsArray, ...emojis: EmojiName[]) => ReturnType<C['reply']>; | ||
replyWithEmoji: (string: TemplateStringsArray, ...emojis: EmojiName[]) => ReturnType<C["reply"]>; | ||
}; | ||
export declare function emoji(name: EmojiName): string; | ||
export declare function emojiParser<C extends EmojiFlavor>(): (ctx: C, next: NextFunction) => Promise<void>; | ||
export declare function emoji(name: EmojiName): string; | ||
export { default as Reactions } from "./reactiondata.js"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.emoji = exports.emojiParser = void 0; | ||
const emoji_js_1 = require("./emoji.js"); | ||
function withEmoji(string, ...emojis) { | ||
return string.reduce((acc, str, index) => { | ||
const emoji = (0, emoji_js_1.default)(emojis[index]); | ||
return acc + str + (emoji ? emoji.emoji : ""); | ||
exports.Reactions = exports.emojiParser = exports.emoji = void 0; | ||
const emojidata_js_1 = require("./emojidata.js"); | ||
function emoji(name) { | ||
var _a; | ||
return (_a = emojidata_js_1.default[name]) !== null && _a !== void 0 ? _a : name; | ||
} | ||
exports.emoji = emoji; | ||
function withEmoji(text, ...emojis) { | ||
return text.reduce((acc, str, idx) => { | ||
var _a; | ||
return acc + str + emoji((_a = emojis[idx]) !== null && _a !== void 0 ? _a : ""); | ||
}, ""); | ||
@@ -19,6 +24,3 @@ } | ||
exports.emojiParser = emojiParser; | ||
function emoji(name) { | ||
var _a, _b; | ||
return (_b = (_a = (0, emoji_js_1.default)(name)) === null || _a === void 0 ? void 0 : _a.emoji) !== null && _b !== void 0 ? _b : ""; | ||
} | ||
exports.emoji = emoji; | ||
var reactiondata_js_1 = require("./reactiondata.js"); | ||
Object.defineProperty(exports, "Reactions", { enumerable: true, get: function () { return reactiondata_js_1.default; } }); |
{ | ||
"name": "@grammyjs/emoji", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Use emoji names instead of Unicode strings. Copy-pasting emoji sucks.", | ||
@@ -9,3 +9,4 @@ "homepage": "https://grammy.dev/plugins/emoji", | ||
"scripts": { | ||
"build": "deno2node tsconfig.json" | ||
"build": "deno2node tsconfig.json", | ||
"prepare": "npm run build" | ||
}, | ||
@@ -12,0 +13,0 @@ "repository": { |
@@ -1,8 +0,9 @@ | ||
# grammY Emoji | ||
# grammY emoji | ||
Adds emoji parsing for [grammY](https://github.com/grammyjs/grammY). Check out the [official documentation](https://grammy.dev/plugins/emoji.html) to learn more about this plugin. | ||
Adds emoji parsing for [grammY](https://github.com/grammyjs/grammY). | ||
Check out the [official documentation](https://grammy.dev/plugins/emoji.html) to learn more about this plugin. | ||
## Installation | ||
Using NPM: | ||
Using npm: | ||
@@ -22,6 +23,6 @@ ```bash | ||
```ts | ||
import {...} from "https://github.com/grammyjs/emoji/src/mod.ts"; | ||
import {/* ... */} from "https://deno.land/x/grammy_emoji/mod.ts"; | ||
``` | ||
## Example Usage | ||
## Usage | ||
@@ -46,3 +47,4 @@ ```ts | ||
bot.command("start", async (ctx) => { | ||
await ctx.replyWithEmoji`Welcome to my bot! ${"grinning_face_with_big_eyes"}`; | ||
await ctx | ||
.replyWithEmoji`Welcome to my bot! ${"grinning_face_with_big_eyes"}`; | ||
// > Welcome to my bot! 😀 | ||
@@ -54,4 +56,4 @@ }); | ||
## Pull Requests | ||
## Contribute | ||
Contributions are more than welcome! Just make sure if there is already a similar PR, so you can contribute from there. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
846983
16696
57
0