Welcome to PhatBot Docs¶
WTF is a PhatBot¶
PhatBot is a Discord and Twitch bot made by Phat32 for… Discord and Twitch.
It can do some cool things, but most note worthy are the Giveaway and Chat Relay functions. There is a whole section just for the Giveaway I would recommend giving a look over, but we can do a quick overview of the Twitch Chat Relay.
Twitch Chat Relay¶
PhatBot can link a Twitch channels chat to 1 or many Discord channels. So anything said in 1 is relayed to them all!
You can say something in twitch and it will be captured in Discord, or if you’re in Discord you can send messages that will appear in Twitch via PhatBot!
This can be a handy tool and neat feature to allow your community to talk to you without leaving Discord. Because it relays to all chats, this includes Discord. If PhatBot is connected to multiple Servers and the Twitch Chat is linked to a channel in each, the chat will go to all servers. Anything said in 1 servers channel will be available in all servers and Twitch equally. It is easy to keep track of the source of the message as it will say [Twitch] if it message originated there, other wise it will say the server name like [Pixel Alliance]
Check out the bot in action at https://phat32.tv
What is PhatBot¶
So, what is a PhatBot?¶
PhatBot is a Discord and Twitch Bot created by Phat32. It was originally created to run giveaways in the Just Good PC Games Discord server but has since expanded to do much more.
Written in C# and hosted in the cloud, PhatBot is generally always online and hanging out ready to accept your commands
Twitch Chat Relay¶
PhatBot can link a Twitch channels chat to 1 or many Discord channels. So anything said in 1 is relayed to them all!
You can say something in twitch and it will be captured in Discord, or if you’re in Discord you can send messages that will appear in Twitch via PhatBot!
This can be a handy tool and neat feature to allow your community to talk to you without leaving Discord. Because it relays to all chats, this includes Discord. If PhatBot is connected to multiple Servers and the Twitch Chat is linked to a channel in each, the chat will go to all servers. Anything said in 1 servers channel will be available in all servers and Twitch equally. It is easy to keep track of the source of the message as it will say [Twitch] if it message originated there, other wise it will say the server name like [Pixel Alliance] in front of the message
Getting Started¶
Inviting PhatBot to your server¶
Inviting PhatBot to your server is super simple, but it does require a password to access the invite link. This is something you can do by being part of the Pixel Alliance crew and heading over to the #resources channel in Discord!
Invite Link: https://phat32.tv/add-phatbot
Once added to the server, a new PhatBot role will be created specifically for PhatBot. I highly recommend moving the PhatBot Role to where you want in the permission structure. Make sure it is below any moderator levels otherwise users can give themselves mod powers.
Example, if the permission tree is setup like this
Admin
PhatBot
Mod
Members
Then using the !addrole command, users could add Mod to their roles. Ideally it should be structered more like this
Admin
Mod
PhatBot
Members
Giveaways¶
What are Giveaways?¶
PhatBot was initially built to handle giveways for the Steam Curator group Just Good PC Games. We had been given many keys to giveaway but didn’t have a system in place to run it. I didn’t want to manage spreadsheets, so a bot was the answer!
How do Giveaways work in PhatBot?¶
Giveaways in PhatBot are run in channels in servers. This was done so instead of having people join for every giveaway, they can join giveaways happening in a channel and always be eligible to win!
This means once someone has entered for a giveaway, they are also entered for any future giveaways in that specific channel.
Once a giveaway have started an alert for the Giveaway Alert role will go out giving people a chance to enter if they haven’t already. It will then wait the Giveaway Rate provided when setting up then start giving away games!
If a user has also linked their Steam to PhatBot, if they win a game it will check their list to see if they already own it and if they do it will pick another winner instead.
Once a user wins a game, they are not eligible to win another game in the same giveaway.
If there are no more eligible users but more keys to giveaway, PhatBot will send out a notification encouraging people to enter the giveaway. If no one wins after 2 more attempts the giveaway will automatically end and any remaining keys will be eligible for future giveaways.
How do I enter to win in a giveaway?¶
It is very simple! Go to the server running the giveaway and join the channel that the giveaway is occuring in.
Enter the following command to join the giveaway
!join
How do I leave a giveaway?¶
One may ask, why would someone not want to win? Well that can happen when a user provides the keys to giveaway but doesn’t have the permissions to create a giveaway themselves. So they would want to leave the eligible pool of winners.
Enter the following command to leave the giveaway
!leave
Setup Server for Giveaways¶
To prepare your server for Giveaways, issue the command
!setupgiveaway
This will create the Giveaway Alert role and assign it to everyone in the server. It may take a couple runs of the command to add to everyone. PhatBot will say how many people the role has been assigned too each time the command is issued. This will also enable auto assigning of the role on join to the server.
Setup Channel for Giveaways¶
Once setup, run these 2 commands to enable giveaways in a channel
!bot
!isgiveaway
Adding Keys¶
To add keys, you must have the proper permissions first. This is done to prevent those who would add invalid keys and making a community look bad from… Well doing exactly that.
The system was built around Steam Game Keys specifically at first, but it has been expanded to accept plain text as the Game Name
!addkey Game Name | XXXXX-XXXXX-XXXXX
Replace the Game Name with the name or Steam ID of the game, and replace XXXXX-XXXXX-XXXXX with the actual game key.
For example it can look like this
!addkey Fall Guys Ultimate Knockout | 12345-67890-12345
or look like this
!addkey 1097150 | 12345-67890-12345
At this stage you can also include any DLC Keys that are part of the game by adding them to after the key. You can do this as many times as needed
!addkey 1097150 | 12345-67890-12345 | 54321-09876-54321
!addkey 1097150 | 12345-67890-12345 | 54321-09876-54321 | 09876-54321-09876
DLC can also be added after the fact incase you forgot, over looked or obtained later
To do that use the following command
!adddlc XXXXX-XXXXX-XXXXX | YYYYY-YYYYY-YYYYY
XXXXX-XXXXX-XXXXX is the original key added to PhatBot and YYYYY-YYYYY-YYYYY is the, well DLC key.
!adddlc 12345-67890-12345 | 54321-09876-54321
Creating a Giveaway¶
To create a giveaway you must first enter keys into PhatBot so they can be given away. Please do that first before doing this.
To actually make a giveaway, go to the channel you want the giveaway to operate in and run this command
!addgiveaway Giveaway Name | Days | Hour | Minute | rate
Giveaway Name is the name of the giveaway
Days is how many days from now will the giveaway run. Set to 0 for today
- Hour is the hour of the day the giveaway should run at
Keep in mind PhatBot is in PST. Use !time to get the current time for PhatBot if needed
Minute is the minute of the day the giveaway should start
Rate is how many minutes between each key is given away
In practice it can look something like This
!addgiveaway Phats Awesome Giveaway Time | 10 | 12 | 0 | 5
This will create a new giveaway called Phats Awesome Giveaway Time that will start in 10 days at 12:00 and giveaway a game every 5 minutes
Discord Commands¶
General¶
- !time
Displays the current time for PhatBot
- !addrole role
Adds a role to a users profile. This can only add roles below the level of PhatBots own role.
Example:
!addrole blue
- !removerole role
Removes the role from the users profile
Example:
!removerole blue
- !roll
Rolls a d20
- !roll X d Y
Will roll the X number of Y type of die
Example:
!roll 2d20
- !roll X d Y +/- Z
Will roll the X number of Y type of die, then do math to the final answer
Example:
!roll 2d20-5
- !waifu
Ask PhatBot to be your Waifu. There is a 1 in 10000000 change it will allow it.
- !joke
Tells a joke obtained from the icanhazdadjoke.com API
Anime¶
- !anime name
Will search for an anime matching the provided name and provide the shows synopsis and various details about the show
!anime slime
- !anime name: name index: x
Select a specific anime when there are multiple results
!anime name: slime index: 2
- !character name
Will search for an anime character with the provided name and provide a description of the character
!character rimuru
- !character name: name index: x
Select a specific character when there are multiple results
!character name: son goku index: 3
- !manga name
Will search for an manga with the provided name and provide a synopsis of the manga
!manga yugioh
- !manga name: name index: x
Select a specific manga when there are multiple results
!manga name: yugioh index: 3
Games¶
- !game name
Will search for an game with the provided name and provide a synopsis and various details about the game
!manga Assassins Creed Valhalla
- !game name: name index: x
Select a specific game when there are multiple results
!manga name: Assassins index: 3
Movies/TV¶
- !movie name
Will search for an anime character with the provided name and provide a description of the character
!character Red
- !movie name: name index: x
Select a specific character when there are multiple results
!character name: Harry Potter index: 3
- !show name
Will search for an show with the provided name and provide a synopsis of the manga
!show Avatar The Last Airbender
- !show name: name index: x
Select a specific show when there are multiple results
!show name: avatar index: 1
Pokemon¶
- !pokemon
Will get a random Pokemon and tell you their description and various stats
- !pokemon id
Will get the Pokemon and tell you their description and various stats
!pokemon 65
- !pokemon name
Will get the Pokemon and tell you their description and various stats
!pokemon Alakazam
Star Citizen¶
- !ship name
Will search for an ship with the provided name and provide a details on the ship
!ship Carrack
- !ship name: name index: x
Select a specific ship when there are multiple results
!show name: constellation index: 3
Steam¶
- !steam
PhatBot will DM you directions for telling PhatBot what Steam profile is yours
- !mysteam
Display your Steam Profile as known by PhatBot
- !pickgame
Randomly suggest a game from your library to play
- !pickgame @user
Randomly suggest a game from the library of the mentioned user
Example:
!game @Phat32#0032
- !recent
Show the game you have most recently been playing
- !recent @user
Show the game the mentioned user has been playing most recently
Example:
!recent @Phat32#0032
- !recent X
List the X number of most recent games you have played, up to a max of 15
Example:
!recent 10
- !recent @user X
List the X number of most recent games the mentioned user has played, up to a max of 15
Example:
!recent @Phat32#0032 10
- !top
Show the game with the most play time on your profile according to Steam
- !top X
List the top X number of games you have played according to Steam, up to a max of 15
Example:
!top 10
- !top @user X
List the top X number of games for the mentioned user has played according to Steam, up to a max of 15
Example:
!top @Phat32#0032 10
- !score / !recommended
Get the metacritic store and number of recommendations on Steam for the last suggested game provided by !game
Giveaway¶
- !join
Enter your name into the giveaway channel. This will enter you to win all giveaways happening in the channel, not just active giveaways.
- !unjoin / !leave
Remove your name from the giveaway channel. You will still be able to see the messages, but will not be selected to win.
- !giveaway / !giveaways
Display a list of recent, active, and upcoming giveaways scheduled in the channel
- !keys / !keysleft
Get a count of the number of keys left in the active giveaway
- !nextgiveaway
Get a date a time for the next scheduled giveaway
- !countdown
Get a countdown to the next giveaway, as long as they are scheduled to occur within the week
- !games
Get DMed a list of the games available in the giveaway
- !mutegiveaway
Remove the Giveaway Alert role from your profile, muting the notifications
- !alertgiveaway
Add the Giveaway Alert role to your profile, pinging you when an notification goes out
- !mykeys
Get a DM list of the games you have won and the keys for the game
Giveaway Contributor¶
- !addgame Name / Steam Store Link / Steam Store ID
Add a game to PhatBots knowledgebase. Can profile the Name of the game, the store link, or just the Steam ID of the game
Example:
!addgame Fall Guys Ultimate Knockout !addgame https://store.steampowered.com/app/1097150/Fall_Guys_Ultimate_Knockout/ !addgame 1097150
- !addkey Name | Key
Add a key to PhatBot to be given away later
Name - The name of the game the key is for
Key - The key to be given away
Example:
!addkey Fall Guys Ultimate Knockout | XXXXX-XXXXX-XXXXX
- !addkey Steam URL | Key
Add a key to PhatBot to be given away later
Steam URL - The URL of the game the key is for from Steam
Key - The key to be given away
Example:
!addkey https://store.steampowered.com/app/1097150/Fall_Guys_Ultimate_Knockout/ | XXXXX-XXXXX-XXXXX
- !addkey Steam ID | Key
Add a key to PhatBot to be given away later
Steam ID - The ID of the game the key is for from Steam
Key - The key to be given away
Example:
!addkey 1097150 | XXXXX-XXXXX-XXXXX
- !addkey Name | key | dlc key
Also add DLC to a key in 1 command by adding | dlc key to the end. Multiple DLC keys can be added here
DLC Key - A DLC Key for the game that will be automatically connected to the key being added
Example:
!addkey 1097150 | XXXXX-XXXXX-XXXXX | YYYYY-YYYYY-YYYYY !addkey 1097150 | XXXXX-XXXXX-XXXXX | YYYYY-YYYYY-YYYYY | ZZZZZ-ZZZZZ-ZZZZZ
- !adddlc key | dlc key
Add a DLC Key to be included with a game that was previously added. Multiple DLC Keys can be added at 1 time
Key - The key of a game already added to PhatBot
DLC Key - The key for DLC for the game
Example:
!adddlc XXXXX-XXXXX-XXXXX | YYYYY-YYYYY-YYYYY !adddlc XXXXX-XXXXX-XXXXX | YYYYY-YYYYY-YYYYY | ZZZZZ-ZZZZZ-ZZZZZ
- !addgiveaway Giveaway Name | Days | Hour | Minute | Rate
Create a new giveaway. This will include all keys you have added to PhatBot that are unclaimed or not part of an upcoming giveaway
Giveaway Name - The name of hte giveaway
Days - The number of days from now you want the giveaway to happen on
Hour - The hour of the day you want the giveaway to start (all times are PST for the bot)
Minute - The minute of the hour the giveaway should start
Rate - How many minutes between each key is given away
Example:
!addgiveaway Phats Awesome Giveaway | 10 | 12 | 0 | 5
This will give you a giveaway named “Phats Awesome Giveaway” that will take place in 10 days, at noon PST, giving away a key every 5 minutes
- !giveawayinterval Rate
Update the rate the games are given away in an active giveaway
Rate - The interval in minutes between each game being given away
- !tossin
Add any keys you have added to PhatBot into the current giveaway
- !tossin Name
Add any keys you have added to PhatBot into the giveaway matching the name provided
Name - The name of a giveaway you want to add keys too
- !remainingkeys
Get a list of Keys you have added that have been been given away
- !claim Key
Claim a key you have added, removing it from future or current giveaways
Key - The Key of a game you no longer want to be given away
Example:
!claim XXXXX-XXXXX-XXXXX
- !give / !assign Key | (@User or Discord ID)
Give a key to a specific user that you have added to PhatBot
Key - The Key of the game you want to assign
User - Either the @mention of a user or their Discord ID
Example:
!give XXXXX-XXXXX-XXXXX | @Phat32#0032 !give XXXXX-XXXXX-XXXXX | 157694248504918016
- !takeback / !unwin Game Name | @User
Take back a game that was assigned to or won by someone. They are still DMed the Key if won in a giveaway, so be careful.
Game Name - The name of the game to take back a key from
@User - The @ mention of the user to take the key from
Example:
!unwin Fall Guys Fall Guys Ultimate Knockout | @Phat32#0032
Twitch¶
- !twitch
Get a DM with a code to DM to PhatBot on Twitch to connect your Twitch and Discord accounts together for Steam commands in Twitch
- !mutetwitch
Remove the Twitch Alert role from your profile, muting the notifications of someone going live
- !alerttwitch
Add the Twitch Alert role to your profile, pinging you when someone goes live
Twitter¶
- !like Tweet
Like a provided Tweet
Requires Admin Channel
Tweet - The URL of the tweet to be liked
Example:
!like https://twitter.com/ThePhat32/status/1344951296437075968
Admin¶
- !ban @User
Bans the mentioned use from the server
Example:
!ban @Phat32#0032
- !clear X
Removes the X number of messages sent in the channel
Example:
!clear 10
- !bot
Enabled PhatBot to recivie commands in the channel
- !unbot
Disabled PhatBot from reciving commands in the channel
- !isadmin
Enable the channel to accept Admin Channel commands
- !isnotadmin
Removes the ability to issue Admin Channel commands
- !isgiveaway
Enabled giveaways to be run in a channel
- !isnotgiveaway
Removes the ability to run giveaways in the channel
- !endgiveaway
Ends any active giveaways in the channel
- !enabletwitch
Creates the Twitch Alert role and assigns it to all members of the Discord and will automatically assign it to anyone joining. May need to be run several times in large population servers to assign it to everyone
- !settwitch twitch
Configures a channel to be connected to a Twitch channel to relay the chat
Example:
!settwich Phat32
- !disabletwitch
Disconnects a channel from the connected Twitch channel
- !enabletwitch
Re-enable a previously established twitch connection
- !setupgiveaway
Creates the Giveaway Alert role, assigns it to all members of the Discord and will automatically assign it to anyone joining. May need to be run several times in large population servers to assign it to everyone
- !shutuptwitch
Disables the auto adding of Twitch Alert to new members
- !twitchmute message
Configure the message said by PhatBot when someone uses !mutetwitch
message - The message to be displayed when someone uses !mutetwitch
Example:
!twitchmute You got it boss, you won't get the pings anymore
- !twitchalert message
Configure the message said by PhatBot when someone uses !alerttwitch
message - The message to be displayed when someone uses !alerttwitch
Example:
!twitchalert Here come the pings! You will always know when someone goes live in this server!
- !giveawaymute message
Configure the message said by PhatBot when someone uses !mutegiveaway
message - The message to be displayed when someone uses !mutegiveaway
Example:
!giveawaymute Okay, no more alerts for free games for you I guess
- !giveawayalert message
Configure the message said by PhatBot when someone uses !alertgiveaway
message - The message to be displayed when someone uses !alertgiveaway
Example:
!givewayalert You got it boss! Alerts incoming for free games!
- !joindm message
Configure the message PhatBot DMs when joining the server. This is empty by default.
message - The message to be DMed to new members
Example:
!joindm Hey! Welcome to the server! Super happy to have you here!
- !runjoindm
Get a DM of the join DM that new members will see to verify it looks how you want it to looks
- !enablejoindm
Enables the Join DM feature
- !disablejoindm
Disables the Join DM feature
- !addreact @MessageId, @Emote, @Role
Add a React Role to a message. This role will be assigned to a user if they react to that message with the same emote and removed if they remove the reaction
Example:
!addreact 879904482018873385 :p32Pog: @AwesomeRole
- !removereact @MessageId, @Emote
Remove a React Role from a message
Example:
!removereact 879904482018873385 :p32Pog:
- !clearreacts @MessageId
Remove all React Roles from a message
Example:
!clearreacts 879904482018873385
Getting Started¶
Add PhatBot to my Channel¶
If you are a crew mate in the Pixel Alliance team, PhatBot will automatically join your channel! It may take up to a day for PhatBot to join.
If you’re not in the Pixel Alliance, you can have PhatBot join your channel by going to PhatBots Twitch Page and using the command !join in chat. This will add PhatBot to your channel, however when the bot reboots it may not automatically re-join at the moment. This is being addressed but will be done later.
Link Discord and Twitch accounts in PhatBot¶
You can link your Discord account and Twitch accounts inside of PhatBot as the linkage data does not exist as public information. This allows the usage of the Steam Commands in Twitch, as well as makes it possible to enter giveaways if run in a live stream channel!
To link your accounts, in Discord DM PhatBot the following
!twitch
PhatBot will reply with a unique code to give to PhatBot on Twitch. Take the code and whisper PhatBot
!link XXXXXXXX
PhatBot will reply letting you know the link is complete! If there is an error linking it will also inform you of this
Twitch Commands¶
General Commands¶
- !commands
Get a list of the commands created just for the channel
- !death
Get a count of the number of deaths for the current game
- !followage
Get the total amount of time following the channel
- !quote
Get a random quote from the channels history, or add a number to get a specific quote
Examples:
!quote !quote 69
- !topdeaths
Show the top 3 death counts and the game attached to them
- !uptime
Get the time the stream has currently been active for
- !watchtime
Get the total amount of time spent watching the stream
Fun Commands¶
- !roll
Rolls a d20
- !roll X d Y
Will roll the X number of Y type of die
Example:
!roll 2d20
- !roll X d Y +/- Z
Will roll the X number of Y type of die, then do math to the final answer
Example:
!roll 2d20-5
- !joke
Tells a joke obtained from the icanhazdadjoke.com API
- !waifu
Check to see if PhatBot will agree to be your Waifu or not (probably not)
VIP Commands¶
These are commands that are accessible to VIPs, Mods and Broadcasters
- !death+ {number}
Add to the death counter for the current game being played. Leave blank for adding just 1, or add a number afterwards to add that many if several were missed
Examples:
!death+ !death+ 5
- !death- {number}
Remove a death from the counter for the current game being played. Leave blank for removing just 1, or add a number afterwards to remove that many if several were added in error
Examples:5
!death- !death- 5
- !quote+ Quote
Add a quote to the list of quotes for the channel
Examples:
!quote+ I believe in the you believing in me
Moderator Commands¶
These commands are accessible to Moderators and Broadcasters
- !setcommand Command Response
Create/Update a command unique to the channel. The command must be all 1 word but the Response can be much longer. Multiple Parameters are available to be used in the responses.
params
$user - The person issuing the command I.E. the viewer
$channel - The name of the channel
$title - The current title of the stream
$game - The current game / category name
$randnum - Get a random number between 1 and 100
$randuser - Get a random chatter, they must be active
$param - Accept the text after the command as input for the command (See Below for example)
Example:
!setcommand vibe Right now $user is vibing at $randnum%
This creates the command !vibe for the channel
!vibe
Result:
Right now PhatBot is vibing at 69%
$param Example:
!setcommand so Check out @$param over at twitch.tv/$param!
This creates the command !so for the channel
!so PhatBot
Result:
Check out @PhatBot over at twitch.tv/PhatBot!
- !removecommand Command
Removes a created command from the channel
Example:
!removecommand vibe
- !quote- number
Remove a quote from the list of quotes for the channel, must provide the number of the quote that is being removed
Examples:
!quote- 2
Broadcaster Commands¶
These command must be run by you in your chat to work
- !autoraid
Enable/Disable automatic shoutouts when raided. When enabled and raided PhatBot will use the built in Twitch /shoutout command as well as an annoucement
Example:
!autoraid
- !deathmessage
Configure the message PhatBot replies with for viewers using the !death command
params
$channel - The name of the channel
$deaths - The number of deaths for the game
$game - The title of the Game
Example:
!deathmessage p32RIP $channel has died $deaths times in $game
- !raidmessage
Configure the annoucement that PhatBot uses when raided and autoraid is enabled
params
$raider - The name of the channel that raided
Example:
!raider Thank you $raider for the raid! Check them out over at twitch.tv/$raider p32O7
- !sub message
Sets the message PhatBot will say when someone Subscribes
params
$sub - The name of the subscriber
$months - Cumulative count of months subscribed
$type - The type of Subscription (Prime, Tier 1, etc)
Example:
!sub $sub is coming in with a $type sub! Thank is amazing of you p32O7
- !resub message
Sets the message PhatBot will say when someone Re-Subscribes. If the Sub message is configured and this is left unconfigured PhatBot will use the Sub message as the Re-Sub message.
params
$sub - The name of the subscriber
$months - Cumulative count of months subscribed
$streak - Their current sub streak
$type - The type of Subscription (Prime, Tier 1, etc)
Example:
!resub $sub is coming in for $months months with a $type sub! Thank is amazing of you p32O7
- !giftsub message
Sets the message PhatBot will say when someone Gift subs
params
$sub - The name of the subscriber
$months - Cumulative count of months subscribed
$type - The type of Subscription (Prime, Tier 1, etc)
$gifter - The name of the gifter, if gifted as Anon the name will be displayed as “Anon”
Example:
!giftsub $gifter is handing $sub a $type sub! Thank is amazing of you p32O7
- !communitysub message
Sets the message PhatBot will say when someone gives Community Subscriptions
params
$gifter - The name of the gifter, if gifted as Anon the name will be displayed as “Anon”
$count - The number of subs that were gifted
$type - The type of Subscription (Prime, Tier 1, etc)
Example:
!communitysub $gifter is handing $count $type subs to the chat! Thank is amazing of you p32O7
- !updateping {On|Enabled|Enable|Yes|True}
Configure PhatBot to ping in Discord when stream details are updated like the title or game has changed
Example:
!updateping on !updateping off
Note: PhatBot is specifically looking for On, Enabled, Enable, Yes, and True to activate the alert. Any other value will disable it.