1.2.0 • Published 2 years ago

aoi.txt v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

aoi.txt

aoi.txt allows you to develop bots with aoi.js all with txt files and one line of js.

setup

To start, first install aoi.txt

npm install aoi.txt

Next, you can add the one line of js code and get working in txt files (note: defining bot is not required, the function returns the bot fully setup and can be used for other things.)

index.js / main.js

const bot = require("aoi.txt").textInit("setup.txt") // setup.txt is mentioned below

A setup file is key to letting aoi.txt know where is what. For this example we will call it setup.txt, but it can be named whatever assuming its in correct format and correctly named in index.js / main.js.

The way the setup file works is line based, so every line defines a new variable for aoi.txt to use. A token line is required (TOKEN="...") but you will mostly have all of them. note: INTENTS defaults to [] setup.txt

COMMANDS="commands"
SLASH_COMMANDS="slash_commands"
EVENTS="events"
PREFIX="!"
TOKEN="some_token_here"
INTENTS=["GUILDS", "GUILD_MESSAGES"]

with this we give aoi.txt that are commands folder is in ./commands, slash commands are in ./slash_commands and events are in ./events. as well as prefix being "!", token being "some_token_here" and intents as "GUILDS", "GUILD_MESSAGES".

After that your ready to start adding commands and events.

events

The way events work with aoi.txt is file name based. for example to use commands you need to call onMessage(). to make this work with aoi.txt, you simply just create the file onMessage.txt in your events folder. this will have aoi.txt call it without sending data since there is nothing in the file.

If you want aoi code to run for some events such as readyCommand() you can have it do that. same as before create readyCommand.txt in your events folder. and add some code, example below

events/readyCommand.txt

$log[Launched $userTag[$clientID] with aoi.txt]

commands / slash commands

commands and slash command work pretty much the same. in the file u define constants if needed (note: prototype: "slash" is defined for you when using aoi.txt for slash command files) and add your code.

commands/ping.txt

Pong `$ping ms`

slash_commands/ping.txt

$interactionReply[Pong `$ping ms`]

would both send Pong some_ping ms, in interaction format for slash command form.

variables

variables with aoi.txt is quite simple. you use the left side of an equal symbol as the name and the right side as the value. from here it is passed to the client via bot.variables()

variables.txt

money=0
some_str="some string"

statuses

statuses is similar to variables in they way it functions. you define a name with a value. for multiple you can use END_STATUS.

statuses.txt

text="text 1"
type="playing"
time=12
END_STATUS

text="text 2"
type="watching"
time=12
END_STATUS

constants

for some command or events you need to define something other than a name and some code. for example for readyCommand you can define a channel id as channel and can send messages there. if you want to do this with aoi.txt you can use the CONSTANTS and END_CONSTANTS key words. to use this you would use the format of

CONSTANTS
some_name="some_value"
END_CONSTANTS

from here you can use it in your code like you normally would

events/readyCommand.txt

CONSTANTS
channel="some_channel_id"
END_CONSTANTS

$log[Ready on $userTag[$clientID]]
Ready on $userTag[$clientID]

in your console and in the defined channel you would see Ready on bot_tag

example

an example of aoi.txt in use can be found on the github page for aoi.txt

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago