ANSI escape sequences can be printed to a shell to as instructions. The below is a list of codes I have used often in my CLI programs and I find myself looking up over and over again.
A great article about it can be found here.
| //----------// | |
| //const declarations | |
| const Discord = require("discord.js");//created on version 11.6.3 - May break on v12+ (Have not tested on v12+.) | |
| const bot = new Discord.Client({ disableEveryone: true });//declaring "bot" as the client. | |
| const token = "tokenhere"//bot token goes here | |
| const prefix = "!" //your prefix goes here | |
| //----------// | |
| //code | |
| bot.on("message", async message => {//when a message is sent (that the bot can read) |
ANSI escape sequences can be printed to a shell to as instructions. The below is a list of codes I have used often in my CLI programs and I find myself looking up over and over again.
A great article about it can be found here.
A metatable in Lua defines various extraneous behaviors for a table when indexed, modified, interacted with, etc. They are Lua's core metaprogramming feature; most well known for being useful to emulate classes much like an OOP language.
Any table (and userdata) may be assigned a metatable. You can define a metatable for a table as such:
-- Our sample table
local tab = {}
-- Our metatable
local metatable = {
-- This table is then what holds the metamethods or metafields