Skip to content
Snippets Groups Projects
README.md 1.46 KiB
Newer Older
Stephen D's avatar
Stephen D committed
# cat-disruptor-6500

A Discord bot that reacts to certain messages with certain emojis. More importantly, it also lets you write code!

## Commands:

!START - start the interpreter

!STOP - stop the interpreter

LIST - list all code in memory

SAVE filename - save code into database

LOAD filename - load filename into memory

Stephen D's avatar
Stephen D committed
DIR - list programs you have saved

PUB filename - Publish a program

PUBDIR - List published programs

PUBLOAD id - Load public program by ID (IDs are listed in PUBDIR)

Stephen D's avatar
Stephen D committed
Code is specified by writing `line_num code`. For example, `10 print "hello world"`. This makes it easy to insert new code or overwrite lines.

### Example session

```
!START
10 for x in 0 to 10
20 print x
RUN
> expected NEXT after FOR statement. # oops - we forgot a line
30 next x
LIST
> 10 for x in 0 to 10
> 20 print x
> 30 next x
RUN
> 0
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
# actually, let's print them all on the same line
5 a = ""
20 a += x
LIST
> 5 a = ""
> 10 for x in 0 to 10
> 20 a += x
> 30 next x
RUN
012345678910 # oops - let's add spaces
20 a += " " + x
RUN
> 0 1 2 3 4 5 6 7 8 9 10 # awesome! let's save this program
SAVE count_to_ten
> Saved as count_to_ten
```

The interpreter can execute arbitrary code safely - it includes CPU and memory limits. For information on syntax, check out the xBASIC interpreter: https://git.scd31.com/stephen/xbasic

It even does graphics!

![Example session](https://git.scd31.com/stephen/cat-disruptor-6500/raw/branch/master/example.png)