Add user-friendly names and show enabled languages

This commit is contained in:
1computer1 2019-05-16 20:51:46 -04:00
parent c1842b4df8
commit 3235944d83
24 changed files with 28 additions and 15 deletions

View file

@ -11,24 +11,13 @@ class HelpCommand extends Command {
exec(message) { exec(message) {
return message.util.send([ return message.util.send([
'**Usage:**', '**Usage:**',
'Put a `>` before a code block with a language or an inline code block that has a language to execute it.', 'Put a `>` before a code block or inline codeblock that starts with a language code to execute it.',
'You can add options, separated by semicolons, after the `>`.', 'You can add options, separated by semicolons, after the `>`.',
'', '',
'**Examples:**', '**Enabled Languages (Name: Language Codes):**',
'```', ...this.client.languageHandler.modules.map(lang => `${lang.name}: \`${lang.aliases.join('`, `')}\``),
'>`\u200B``py',
'print(\'Hello world!\');',
'`\u200B``',
'', '',
'>`hs main = print (1 + 1)`', 'See the readme for usage examples, supported languages, and options: <https://github.com/1Computer1/comp_iler>'
'',
'>e; harmony`\u200B``js',
'class Foo { bar = 1; }',
'new Foo().bar;',
'`\u200B``',
'```',
'',
'Read the readme for supported languages and options: <https://github.com/1Computer1/comp_iler>'
]); ]);
} }
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Bash extends Language { class Bash extends Language {
constructor() { constructor() {
super('bash', { super('bash', {
name: 'Bash',
aliases: ['bash', 'sh'] aliases: ['bash', 'sh']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class C extends Language { class C extends Language {
constructor() { constructor() {
super('c', { super('c', {
name: 'C',
aliases: ['c'] aliases: ['c']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Clojure extends Language { class Clojure extends Language {
constructor() { constructor() {
super('clojure', { super('clojure', {
name: 'Clojure',
aliases: ['clojure', 'clj'] aliases: ['clojure', 'clj']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class CPP extends Language { class CPP extends Language {
constructor() { constructor() {
super('cpp', { super('cpp', {
name: 'C++',
aliases: ['cpp', 'c++'] aliases: ['cpp', 'c++']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class CSharp extends Language { class CSharp extends Language {
constructor() { constructor() {
super('csharp', { super('csharp', {
name: 'C#',
aliases: ['csharp', 'cs'], aliases: ['csharp', 'cs'],
options: { options: {
e: () => '' e: () => ''

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Elixir extends Language { class Elixir extends Language {
constructor() { constructor() {
super('elixir', { super('elixir', {
name: 'Elixir',
aliases: ['elixir'] aliases: ['elixir']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class FSharp extends Language { class FSharp extends Language {
constructor() { constructor() {
super('fsharp', { super('fsharp', {
name: 'F#',
aliases: ['fsharp', 'fs'] aliases: ['fsharp', 'fs']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Go extends Language { class Go extends Language {
constructor() { constructor() {
super('go', { super('go', {
name: 'Go',
aliases: ['golang', 'go'] aliases: ['golang', 'go']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Haskell extends Language { class Haskell extends Language {
constructor() { constructor() {
super('haskell', { super('haskell', {
name: 'Haskell',
aliases: ['haskell', 'hs'], aliases: ['haskell', 'hs'],
options: { options: {
e: () => '' e: () => ''

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Java extends Language { class Java extends Language {
constructor() { constructor() {
super('java', { super('java', {
name: 'Java',
aliases: ['java'] aliases: ['java']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class JavaScript extends Language { class JavaScript extends Language {
constructor() { constructor() {
super('javascript', { super('javascript', {
name: 'JavaScript',
aliases: ['javascript', 'js'], aliases: ['javascript', 'js'],
options: { options: {
harmony: () => '', harmony: () => '',

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Julia extends Language { class Julia extends Language {
constructor() { constructor() {
super('julia', { super('julia', {
name: 'Julia',
aliases: ['julia'], aliases: ['julia'],
options: { options: {
e: () => '' e: () => ''

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Lua extends Language { class Lua extends Language {
constructor() { constructor() {
super('lua', { super('lua', {
name: 'Lua',
aliases: ['lua'] aliases: ['lua']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class OCaml extends Language { class OCaml extends Language {
constructor() { constructor() {
super('ocaml', { super('ocaml', {
name: 'OCaml',
aliases: ['ocaml'] aliases: ['ocaml']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Pascal extends Language { class Pascal extends Language {
constructor() { constructor() {
super('pascal', { super('pascal', {
name: 'Pascal',
aliases: ['pascal', 'pas', 'freepascal'] aliases: ['pascal', 'pas', 'freepascal']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Perl extends Language { class Perl extends Language {
constructor() { constructor() {
super('perl', { super('perl', {
name: 'Perl',
aliases: ['perl', 'pl'] aliases: ['perl', 'pl']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class PHP extends Language { class PHP extends Language {
constructor() { constructor() {
super('php', { super('php', {
name: 'PHP',
aliases: ['php'] aliases: ['php']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Prolog extends Language { class Prolog extends Language {
constructor() { constructor() {
super('prolog', { super('prolog', {
name: 'Prolog',
aliases: ['prolog'] aliases: ['prolog']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Python extends Language { class Python extends Language {
constructor() { constructor() {
super('python', { super('python', {
name: 'Python',
aliases: ['python', 'py'], aliases: ['python', 'py'],
loads: ['python3', 'python2'], loads: ['python3', 'python2'],
options: { options: {

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Racket extends Language { class Racket extends Language {
constructor() { constructor() {
super('racket', { super('racket', {
name: 'Racket',
aliases: ['lisp'] aliases: ['lisp']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Ruby extends Language { class Ruby extends Language {
constructor() { constructor() {
super('ruby', { super('ruby', {
name: 'Ruby',
aliases: ['ruby', 'rb'] aliases: ['ruby', 'rb']
}); });
} }

View file

@ -3,6 +3,7 @@ const Language = require('../struct/Language');
class Rust extends Language { class Rust extends Language {
constructor() { constructor() {
super('rust', { super('rust', {
name: 'Rust',
aliases: ['rust', 'rs'] aliases: ['rust', 'rs']
}); });
} }

View file

@ -3,12 +3,14 @@ const { AkairoModule } = require('discord-akairo');
class Language extends AkairoModule { class Language extends AkairoModule {
constructor(id, { constructor(id, {
category, category,
name,
aliases, aliases,
loads = [id], loads = [id],
options = {} options = {}
} = {}) { } = {}) {
super(id, { category }); super(id, { category });
this.name = name;
this.aliases = aliases; this.aliases = aliases;
this.loads = loads; this.loads = loads;
this.options = options; this.options = options;