[DOC] How to Create / Setup a Discord bot with RAT

Trekkan

JFF Administrator
Staff member
Discord roles are hierarchical in nature. Meaning, the role listed in Discord Server Settings at the top, is the most "powerful" above any roles under it. So whatever role you have assigned to your bot, needs to have permissions that #1, allow it to read/write messages, but also if you want to ban a person from Discord through it (as an example), the bot would have to have a role higher than the person the bot is trying to ban.

Also, as a test. Try setting your bots permissions to "Administrator" and see if that works. I think the Discord API might have changed and could be causing some issues as well.
 
Tried giving it Admin access, still didn't work. Does the "username" for the bot have to be somethhing new, or does it have to be an existing Discord username?
 

Trekkan

JFF Administrator
Staff member
Tried giving it Admin access, still didn't work. Does the "username" for the bot have to be somethhing new, or does it have to be an existing Discord username?
Nope, can be anything. I was testing last night and was able to make mine work, so... not sure at the moment.
 
Ok, somehow it just started working, which is nice, but then starting reporting EVERYTHING that was happening in my main discord "general" channel and not my 7D2D channel. Still can't get it to show the sub-channel's in the RAT integration dropdown. Ugh. Any ideas on that one?

Also, is there a way to customize what the bot will report to Discord?
 

Trekkan

JFF Administrator
Staff member
Ok, somehow it just started working, which is nice, but then starting reporting EVERYTHING that was happening in my main discord "general" channel and not my 7D2D channel. Still can't get it to show the sub-channel's in the RAT integration dropdown. Ugh. Any ideas on that one?

Also, is there a way to customize what the bot will report to Discord?
Sounds like in trying ot get it to work, at some point you saved your "general" discord channel in the RAT settings, instead of the one you wanted? I'd try redoing the Discord setup in RAT. You need to hit the "Test" button on the Discord setup in RAT, which then attempts to connect to your server and downloads your channel list. That then populates the channel list so you can tell RAT which channel you want to output to.

As for customization, not much currently. However I'm going to be redoing the RAT Discord code, so there should be a lot of new features and options when I'm done.
 
i setup everything but when i go to test connection nothing happens it stays red on both discord connection and guild connection?
 

Trekkan

JFF Administrator
Staff member
I'd have to look at it on Teamviewer or something, no idea from what I can see right now.
 
we can teamview just let me know when... cause im stumped!! the bot i made is in the discord just offline cause RAT test not working for me
 

Dradonis

New Member
As for customization, not much currently. However I'm going to be redoing the RAT Discord code, so there should be a lot of new features and options when I'm done.
How is this getting along? Main reason is that it would be great to turn off spam messages such as the backup process, server reboot and countdown to reboot messages on a toggle.
 

Trekkan

JFF Administrator
Staff member
How is this getting along? Main reason is that it would be great to turn off spam messages such as the backup process, server reboot and countdown to reboot messages on a toggle.
There hasn't been a lot of work done on this lately as I just haven't had the time.

However, if you just want to edit the messages, you can. Click the Gear icon in RAT (Event Editor), and then just remove the lines you want for the events you want. Or, disable the event entirely if that's what you want.
 

Dradonis

New Member
Literally just discovered you can do it all in the event editor as you replied, big facepalm for me. Yeah all the options are there, just wasn't looking in the right place. My bad!
 

sTarBuZz

New Member
Hi there. I followed the tutorial step by step and got the bot to join my server, but I don't know how I get it to join a channel. I don't see a channels list in the RAT and there was no popup.
The messages from game chat go directly to my main (welcome) channel.
Writing messages in discord, using !say command works from any channel.
 
Last edited:

Trekkan

JFF Administrator
Staff member
Hi there. I followed the tutorial step by step and got the bot to join my server, but I don't know how I get it to join a channel. I don't see a channels list in the RAT and there was no popup.
The messages from game chat go directly to my main (welcome) channel.
Writing messages in discord, using !say command works from any channel.
You do that by editing the events in RAT for the specific events that happen. If you go into the event editor (link on the main bar of RAT), then edit the event and change the channel name to your Discord channel name.
 

sTarBuZz

New Member
You do that by editing the events in RAT for the specific events that happen. If you go into the event editor (link on the main bar of RAT), then edit the event and change the channel name to your Discord channel name.
Thanks for the answer. I'll have a look at the events tomorrow.

EDIT:
I found out how to set the channel name in the event's script, but I have my channel in a category. 7 Days To Die -> #text. How would I write it in the SCRIPT?
.DSAY:7daystodie#text:{player_name} is connected to the server. ?
 
Last edited:

Trekkan

JFF Administrator
Staff member
Sorry for the late replies, but categories don't matter, just use the channel name. =)
 

LightninDud

New Member
After following the instructions here. After performing the test connection, all lights remain green and the bot appears correctly. But there is no dropdown box to tell the bot what channel to use at all. The bot has higher-level permissions server-wide in our discord and within the channel category. No matter where in the role list we set it to, that dropdown box or whatever doesn't appear/

I don't really understand how the scripts work, I tried a tiny bit of it but it doesn't seem to do anything. The actual 7D2D Server is functioning properly and the bot is online.
 

Trekkan

JFF Administrator
Staff member
After following the instructions here. After performing the test connection, all lights remain green and the bot appears correctly. But there is no dropdown box to tell the bot what channel to use at all. The bot has higher-level permissions server-wide in our discord and within the channel category. No matter where in the role list we set it to, that dropdown box or whatever doesn't appear/

I don't really understand how the scripts work, I tried a tiny bit of it but it doesn't seem to do anything. The actual 7D2D Server is functioning properly and the bot is online.
These docs are a little dated at this point, but there is no longer a dropdown for a "global channel". You edit the event in the RAT event editor and specify the name of the channel where the .DSAY, .EMBED and such commands are used. This allows you to send to specific channels. The old way with the dropdown was only a single channel, this way, whatever you can send to whatever channel you want, as well as the bot listens on whatever channels you give it access to in Discord.
 
Top