-
Notifications
You must be signed in to change notification settings - Fork 1
1. Getting started
The project is currently outdated with latest version of Pogly. If you're interested in developing a bot, please ping @Dynny on Discord to get this updated
First things to note, this bot does not support sending messages to chat. If you're looking for that kind of functionality, you'll have to build one yourself and use this repository as an example how to integrate Pogly functionality into it.
As of writing this documentation, Pogly was not designed with bots in mind so some functionality might be a bit scuffed. This will hopefully be made better in the future.
To get started, clone the repository on to your computer and install the required NPM packages via npm install.
Once the packages have been installed, open up .env which is located in the root of the project. There you will find the required configurations for the bot to function.
TWITCH_CHANNEL=""
BOT_GUEST_NAME=""
; Pogly cloud: wss://pogly.spacetimedb.com
; You need to use this domain if your module was published by Pogly bot in Pogly Discord
POGLY_DOMAIN=""
POGLY_MODULE=""
POGLY_AUTHENTICATION_KEY=""
COMMAND_PREFI="!"You'll have to fill the required variables with your own information.
-
TWITCH_CHANNELis the channel whose chat the bot connects to. As a good rule of thumb, just copy the name from the channel URL. -
BOT_GUEST_NAMEis the name given to the bot when it connects to the Pogly module. While this is not required, you should give the bot a name when running it for the first time as it will most likely be required in a bit. -
POGLY_DOMAINis the domain where your Pogly module is hosted in. If you're self-hosting Pogly, you need to put the same URL here that you use to connect to your module through the website. If you're using a module hosted by us (Published using the Discord bot), this needs to bewss://pogly.spacetimedb.com. -
POGLY_MODULEis the name of your Pogly module. -
POGLY_AUTHENTICATION_KEYis the authentication key for your Pogly module. (Only if required by the module)
Once the .env is setup, you're ready to run the bot for the first time. You can do so by either running npm run start_bot or running start_bot.bat in the project root folder. If everything is setup correctly, you should see: Connected to SpacetimeDB! [xxx] @ [xxx] in the console.
If your module uses strict mode, you should now go and give the bot moderator from the editor. After you've done this, you can remove BOT_GUEST_NAME so it does not appear in the editor.
The bot has a built in command handler and creating new commands is very easy. All commands should be put in src/commands folder and should be .ts files. The folder comes witn a template command file: Template.ts which you can either copy the code from into your new command file or just copy the file and rename it to whatever you want your command to be. The file name is the command name, if you name the file ping.ts, the command is !ping.
const template: Command = {
async execute(tags: ChatUserstate, args: string[]) {
// Execute command code here
},
};
export default template;The command gets couple arguments:
-
tagsvarious information about the message sender. -
argsthe arguments given to the command.
You can find basic examples for different features in the Examples page.