smogon / Porygon-Z

The Bot for the Official Smogon Discord (WIP)
https://discord.gg/smogon
MIT License
13 stars 6 forks source link

Porygon-Z

The Bot for the Official Smogon Discord.

Setting up your Bot

Prerequisites

To setup your bot, you will need:

Creating up a discord application and your bot's account

Head over to the discord developer portal's application page and sign in if you haven't and either create a new application for your bot or select an existing one. The bot's name is not the applications name. You should now be in the general information tab for your application, note that you can see a clientid here. The application's clientid will be necessary for inviting your bot to a server later. Switch to the bot tab and create a bot, do note that you cannot destroy a discord bot once you create it. Now on the bot page, you should be able to name your bot and see its token. Your bot's token is basically its password so keep it safe, we will need it later.

Adding your bot's account to a discord server

Once you have created your bot, you will need to add it to a server. You will need Manage Server permissions in the server you want to add the bot to. You can also create a new server if you want, check the prerequisites list for a link with instructions on that. Once you know what server you want to add the bot to, you need to create your invite link. Your invite link will be in the form of:

https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID_HERE&scope=bot

where CLIENT_ID_HERE is your application's client id that can be found under the general information tab. You can also add a permissions flag to guarantee that the bot will have certian permissions after it joins the server. The form of an invite link with permissions is:

https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID_HERE&scope=bot&permissions=INTEGER

Where INTEGER is a number that represents what permissions the bot has. There is a calculator for this on your application's bot page.

Once you have your invite link, follow it and authorize your bot to join the server in question and it should show up in the userlist.

Installing and starting the bot itself

Now that your bot's account has been added to the server(s) you want it in, you need to setup the bot itself. First make sure you have NodeJS 10 or later installed. Next, clone the bot with git or download and unzip the bot's files. Once you have your files, create a file called .env in the root folder of your bot. .env's contents should look like this:

TOKEN=BOT_TOKEN
ERRCHANNEL=CHANNELID
ADMINS=SNOWFLAKE,SNOWFLAKE,...
PREFIX=!
DBVERSION=max
PGHOST=localhost
PGPORT=5432
PGUSER=porygonz
PGPASSWORD=null
PGDATABASE=porygonz

After setting up your .env file run npm i --production to install dependencies (exclude the --production flag if you plan to contribute to Porygon-Z so that developer dependencies are installed too). After that running npm start should start your bot up.

License

MIT