Emoji - Use emoji names instead of Unicode strings. Copy-pasting emoji sucks.

Overview

Grammy Emoji

Adds emoji parsing for grammY. Check out the official documentation for this plugin. While this draft is working, we still do not recommend using it in production.

Installation

Using NPM:

npm install @grammyjs/emoji // TBD

Using Yarn:

yarn add @grammyjs/emoji // TBD

Using Deno:

import {...} from "https://github.com/grammyjs/emoji/src/mod.ts";

Example usage

import { Bot, Context } from "grammy";
import { EmojiFlavor, emojiParser } from "@grammyjs/emoji";

type FlavoredContext = Context & EmojiFlavor;
const bot = new Bot<FlavoredContext>(process.env.TOKEN);

bot.use(emojiParser());

bot.command("ping", async (ctx) => {
    // Don't know emoji names? No problem!
    // Press Ctrl + Space on supported editors to
    // see IntelliSense auto-completion magic.
    await ctx.reply(ctx.emoji`Pong! ${"table_tennis"}`); // Pong! πŸ“
});

bot.command("start", async (ctx) => {
    await ctx.replyWithEmoji`Welcome to my bot! ${"smiley"}`; // Welcome to my bot! πŸ˜ƒ
});

bot.start();

Pull requests

Contributions are more than welcome! Just make sure if there is already a similar PR, so you can contribute from there.

Comments
  • Move from skypack to esm.sh

    Move from skypack to esm.sh

    There is a problem with skypack. It seems like it is unable to build the new types dependency. All plugins and grammY are migrating to https://esm.sh now, which does not have the same problem.

    opened by KnorpelSenf 4
  • (Proper) Emojis + Skin toned emojis and a script to fetch

    (Proper) Emojis + Skin toned emojis and a script to fetch

    EmojiPedia has confirmed that Telegram uses Apple emojis. So, I tried scraping the site, and they have skin toned emojis too. I have made a JSON and a TS file which exports emoji object as default. The TS file has has simple JSDoc comments, in the format "πŸ˜€ Grinning Face" as @KnorpelSenf suggested here. I am not sure about which file to use for the plugin. It contains 3961 emojis at the moment.

    I have made a script to scrape them. Also, I don't think it can be used forever. And it's scraping, it takes a lot of time. Around ~20+ minutes. And the script could be much much faster.

    opened by dcdunkan 4
  • Added emoji file parsing

    Added emoji file parsing

    Added a script to parse official emojis list from txt to JSON. This still needs one last fix in src/emojis.ts typing. I'll be grateful if someone can fix this.

    Fix #3 Fix #4 References #2

    help wanted 
    opened by andrrms 4
  • Context flavour does not respect adjusted return types of `ctx.reply`

    Context flavour does not respect adjusted return types of `ctx.reply`

    Feature request

    If I adjust the return type of ctx.reply using a different plugin, such as the hydrate plugin, I would like the type of ctx.replyWithEmoji to adjust accordingly. This makes it necessary to use a transformative context flavour, rather than an additive one.

    help wanted to be investigated 
    opened by KnorpelSenf 3
  • Prepare for publish

    Prepare for publish

    There were a lot things that needed to be fixed before this could be released. A few errors in docs, a few compilation errors, a few config mistakes in tsconfig.json as well as package.json, missing formatting, and other stuff.

    This PR fixes all of the above issues and makes the package ready to be published as 1.0. As the changes are not semantically related, and a reformatting of most files was performed, this PR should be review per commit, and with hidden whitespace changes.

    opened by KnorpelSenf 1
  • Add support for skin-toned emojis

    Add support for skin-toned emojis

    This plugin MUST support skin-toned emojis (πŸ‘πŸ‘πŸ»πŸ‘πŸΌπŸ‘πŸ½πŸ‘πŸΎπŸ‘πŸΏ) since they're a fundamental part of Unicode emojis.

    Quick thoughts:

    • Maybe it can use neutral-toned emojis (πŸ‘) + Unicode general skin tone codes (🏻🏼🏽🏾🏿) // Is this possible?
    • It can be accessed like this:
    ctx.emoji`${"like:medium-dark"}` // πŸ‘πŸΎ
    ctx.emoji`${"punch:light"}` // πŸ‘ŠπŸ»
    ctx.emoji`${"raised_hands"}` // πŸ™Œ
    
    todo feature request 
    opened by andrrms 1
  • Add support for new Unicode 14 emojis

    Add support for new Unicode 14 emojis

    This plugin MUST have new emojis coming from Unicode 14, even if they haven't been added to Telegram yet β€” soon they will come.

    This is related to PR #2

    todo feature request 
    opened by andrrms 1
  • Add new emoji file

    Add new emoji file

    I created this emoji file a long time ago when I had the idea for the plugin.

    I think it is the most comprehensive set of emoji I could find when I did some research. Then again, it was created in October, so maybe new emoji were added since then.

    You may need to perform some further processing to make it useful, such as converting the unicode points to the actual emoji strings. Or maybe this file isn't useful at all. You can decide what do to with it.

    Either way, I wanted to upload it somewhere in case it becomes useful in the future.

    to be investigated 
    opened by KnorpelSenf 1
  • [DO NOT MERGE] Illustration for how #8 could be solved

    [DO NOT MERGE] Illustration for how #8 could be solved

    Suggestion for what I would expect from #9 in order to fix #8. However, this does not work as intended, so this PR must not be merged.

    Related to https://github.com/grammyjs/emoji/pull/9#pullrequestreview-923838457.

    opened by KnorpelSenf 0
Owner
null
Easily add emoji support to your website! Replace keywords with emoji's :yum:

Emoji-Parser.js ?? A emoji parser to easily add emoji support to your website Show your support! Features: Use's the same style GitHub does! TON's of

Marketing Pipeline 13 Sep 9, 2022
Trim unnecessary indentation when pasting code

Unindent When pasting code from your editor into Discord, it often ends up having a lot of indentation. This plugin fixes that by trimming unnecessary

Vens Powercord Plugins 19 May 1, 2022
Rename image after pasting, support name pattern and auto renaming.

Obsidian paste image rename This plugin is inspired by Zettlr, Zettlr shows a prompt that allows the user to rename the image, this is a great help if

Xiao Meng 82 Jan 2, 2023
When pasting screenshots into obsidian notes, convert the images to jpeg and compress them

obsidian-paste-png-to-jpeg This plugin is inspired by obsidian-paste-image-rename, obsidian-paste-image-rename can be used when inserting images renam

null 19 Nov 15, 2022
Lightweight (< 2.3kB gzipped) and performant natural sorting of arrays and collections by differentiating between unicode characters, numbers, dates, etc.

fast-natural-order-by Lightweight (< 2.3kB gzipped) and performant natural sorting of arrays and collections by differentiating between unicode charac

Shelf 5 Nov 14, 2022
A handy little app for copying & pasting images.

PikPicPASTE A handy little app for copying & pasting images. Usage Click and drag the hamburger tile to move the toolbar Click the hamburger tile to s

null 5 Nov 1, 2022
Quo is a (free) debugging companion app to help you debug dumped variables, the dumped variables will appear in this Quo client instead of the traditional way which is often tedious.

Quo is a debugging companion to help you debug dumped variables, the dumped variables will appear in this Quo client instead of via the traditional way which is often tedious.

Protoqol 33 Dec 25, 2022
kakaolink-plugin is a remote-kakao plugin for sending KakaoLinks instead of plain text

kakaolink-plugin Discord Server About kakaolink-plugin is a remote-kakao plugin for sending KakaoLinks instead of plain text. Requirements Node.js v17

null 5 Oct 1, 2022
shell script replacement; write shell scripts in js instead of bash, then run them with a single static binary

yavascript YavaScript is a bash-like script runner which is distributed as a single statically-linked binary. Scripts are written in JavaScript. There

Lily Scott 59 Dec 29, 2022
Patches the AssemblyScript compiler to utilize WASI imports instead of Web APIs.

WASI shim for AssemblyScript Patches the AssemblyScript compiler to utilize WASI imports instead of Web APIs. Note that this shim also serves a higher

The AssemblyScript Project 37 Dec 23, 2022
Pure JavaScript library that add .is-hover class instead of css :hover for mobile and desktop.

MultiDeviceHover Pure JavaScript library that add .is-hover class instead of css :hover for mobile and desktop. Usage Install Using npm, install multi

Ryuta Sakai 1 Oct 5, 2021
A simple JS example for NextAuth Google login with a popup window instead of redirect.

A simple JS example for NextAuth Google login with a popup window instead of redirect.

null 13 Dec 7, 2022
A fully type-safe and lightweight way of using exceptions instead of throwing errors

??️ exceptionally A fully type-safe and lightweight way of using exceptions instead of throwing errors ?? fully typesafe ?? lightweight (209 bytes) ??

Hofer Ivan 16 Jan 4, 2023
A Chromium extension that enables users to use customizable :emoji: on Facebook/Facebook Messenger.

:emoji: for Messenger A Chromium extension that enables users to use customizable :emoji: on Facebook/Facebook Messenger. Install Download the extensi

null 4 Aug 31, 2022
Minifies css variable names

PostCSS Variable Compress postcss-variable-compress is a PostCSS plugin minifies variable names and saves space. Even if you have 1295 css variables s

null 20 Nov 19, 2022
Tired of boring balena device names? Why not let us choose!

name-block A balenaBlock for fun device renaming Highlights Bored of your device names?: Let this block rename them for you! Loads of categories: From

Alex Bucknall 3 Dec 20, 2021
NoPrint.js - Disable Print, Screenshot, Copy & Paste in HTML by JavaScript.

NoPrint.js Disable Print, Screenshot, Copy & Paste in HTML by JavaScript. NoPrint.js is a small and neat open source JS library that disables print, s

null 33 Dec 26, 2022
Lightweight library to copy PNG and JPG images to clipboard

Copy Image Clipboard Created with ❀️ by Luan Eduardo da Costa | Follow me on Linkedin ?? About This library allows you to copy JPG and PNG images (onl

Luan Eduardo da Costa 34 Nov 29, 2022
Input a list of Handshake top-level domains, outputs names sorted into 4 arrays: available, registered, reserved, or invalid.

name-check A simple NodeJS package that, given a flat list of top-level domain names, queries the Handshake (HNS) blockchain in order to classify each

Neel Yadav 2 Jan 8, 2022