Skip to content

Instantly share code, notes, and snippets.

@peakh
Last active August 12, 2023 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peakh/de9c9cf533465924fe0e1f1f9bd15132 to your computer and use it in GitHub Desktop.
Save peakh/de9c9cf533465924fe0e1f1f9bd15132 to your computer and use it in GitHub Desktop.
Discord-supported codeblock languages in one interface in TypeScript.

Send the code block within a Discord channel:

import languages from "./languages";
import { codeBlock } from "discord.js";

return await interaction.reply({
	content: codeBlock(languages.Python, "Hello World!"),
	ephemeral: true
});
const Languages = {
    OneC: "1c",
    ABNF: "abnf",
    AccessLog: "accesslog",
    Ada: "ada",
    Arduino: "arduino",
    Armasm: "armasm",
    Avrasm: "avrasm",
    ActionScript: "actionscript",
    AngelScript: "angelscript",
    Apache: "apache",
    AppleScript: "applescript",
    Arcade: "arcade",
    AsciiDoc: "asciidoc",
    AspectJ: "aspectj",
    AutoHotkey: "autohotkey",
    AutoIt: "autoit",
    Awk: "awk",
    Bash: "bash",
    Basic: "basic",
    Bnf: "bnf",
    Brainfuck: "brainfuck",
    C: "c",
    CSharp: "csharp",
    CPlusPlus: "cpp",
    Cal: "cal",
    CacheObjectScript: "cos",
    CMake: "cmake",
    Coq: "coq",
    CSP: "csp",
    CSS: "css",
    CapnProto: "capnproto",
    Clogure: "clojure",
    CoffeeScript: "coffeescript",
    Crmsh: "crmsh",
    Crystal: "crystal",
    D: "d",
    Dart: "dart",
    Delphi: "delphi",
    Diff: "diff",
    Django: "django",
    DNSZoneFile: "dns",
    Dockerfile: "dockerfile",
    DOS: "dos",
    dsconfig: "dsconfig",
    DTS: "dts",
    Dust: "dust",
    EBNF: "ebnf",
    Elixir: "elixir",
    Elm: "elm",
    Erlang: "erlang",
    Excel: "excel",
    FSharp: "fsharp",
    FIX: "fix",
    Flix: "flix",
    Fortran: "fortran",
    GCode: "gcode",
    Gams: "gams",
    GAUSS: "gauss",
    Gherkin: "gherkin",
    Glimmer: "html.hbs",
    Go: "go",
    Golo: "golo",
    Gradle: "gradle",
    GraphQL: "graphql",
    Groovy: "groovy",
    HTML: "html",
    HTTP: "http",
    Haml: "haml",
    HandleBars: "hbs",
    Haxe: "haxe",
    Hy: "hy",
    Ini: "ini",
    Inform7: "inform7",
    IRPF90: "irpf90",
    JSON: "json",
    Java: "java",
    JavaScript: "javascript",
    Julia: "julia",
    Kotlin: "kotlin",
    LaTeX: "tex",
    Leaf: "leaf",
    Lasso: "lasso",
    Less: "less",
    LDIF: "ldif",
    Lisp: "lisp",
    LiveCodeServer: "livecodeserver",
    LiveScript: "livescript",
    Lua: "lua",
    Makefile: "makefile",
    Markdown: "markdown",
    Mathematica: "mathematica",
    Matlab: "matlab",
    Maxima: "maxima",
    MayaEmbeddedLanguage: "mel",
    Mercury: "mercury",
    MIPSAssembler: "mipsasm",
    Mizar: "mizar",
    Mojolicious: "mojolicious",
    Monkey: "monkey",
    MoonScript: "moonscript",
    N1QL: "n1ql",
    NSIS: "nsis",
    Nginx: "nginx",
    Nim: "nim",
    Nix: "nix",
    OCaml: "ocaml",
    ObjectiveC: "objectivec",
    OpenGLShadingLanguage: "glsl",
    OpenSCAD: "openscad",
    OracleRulesLanguage: "ruleslanguage",
    Oxygene: "oxygene",
    PF: "pf",
    PHP: "php",
    Parser3: "parser3",
    Perl: "perl",
    Plaintext: "plaintext",
    Pony: "pony",
    PostgreSQL: "postgresql",
    PowerShell: "powershell",
    Processing: "processing",
    Prolog: "prolog",
    Properties: "properties",
    ProtocolBuffers: "protobuf",
    Puppet: "puppet",
    Python: "python",
    PythonProfilerResults: "profile",
    PythonREPL: "python-repl",
    Q: "k",
    QML: "qml",
    R: "r",
    ReasonML: "reasonml",
    RenderManRIB: "rib",
    RenderManRSL: "rsl",
    Roboconf: "graph",
    Ruby: "ruby",
    Rust: "rust",
    SAS: "sas",
    SCSS: "scss",
    SQL: "sql",
    STEPPart21: "p21",
    Scala: "scala",
    Scheme: "scheme",
    Scilab: "scilab",
    Shell: "shell",
    Smali: "smali",
    Smalltalk: "smalltalk",
    SML: "sml",
    Stan: "stan",
    Stata: "stata",
    Stylus: "stylus",
    SubUnit: "subunit",
    Swift: "swift",
    Tcl: "tcl",
    TestAnythingProtocol: "tap",
    Thrift: "thrift",
    TP: "tp",
    Twig: "twig",
    TypeScript: "typescript",
    VBNet: "vbnet",
    VBScript: "vbscript",
    VHDL: "vhdl",
    Vala: "vala",
    Verilog: "verilog",
    Vim: "vim",
    XPlusPlus: "axapta",
    x86Assembly: "x86asm",
    XL: "xl",
    XML: "XML",
    XQuery: "xquery",
    YAML: "yaml",
    Zephir: "zephir",
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment