Skip to content
DanimalsTCGYT edited this page Aug 4, 2024 · 8 revisions

A discord bot written entirely in osl, requires originOS v5.0.0

import "discord" connect wait 1 login "token" messages = 0 mainloop: heartbeat if discord.wsHasnew() ( msg = discord.wsGetnext() cmd = msg."t" if cmd == "ready" ( bot_user = msg."d"."user" bot_name = bot_user."username" bot_pfp = "https://cdn.discordapp.com/avatars/" ++ bot_user."id" ++ "/" ++ bot_user."avatar" ++ ".png?size=512" log "logged in as" + bot_name ) sent_by if cmd == "MESSAGE_CREATE" and data."username" != bot_name ( dat = msg."d"."content" if dat.startsWith("!hello") ( send_message "Hello world!" msg."d"."channel_id" ) // commands go here ) messages ++ ) loc 2 2 10 -20 text "Total messages:" + messages 10 : c#fff goto 0 0 image bot_pfp 200 goto bot_name.len * -5 -100 text bot_name 10 loc 2 -2 20 20 direction timer * 200 icon "w 3 cutcircle 0 0 10 0 100" 1 import "win-buttons"

originOS Wiki

Wiki Views:
:views

OSL | RSH | ICN

Clone this wiki locally