2019-04-15 09:12:56 -07:00
import rpg_utils
from discord . ext import commands
bot = commands . Bot ( command_prefix = ' .rpg ' )
@bot.command ( )
async def begin ( ctx ) :
if rpg_utils . playerexists ( ctx . author ) :
await ctx . send ( " You ' ve already begun your journey! " )
else :
rpg_utils . addplayer ( ctx . author )
await ctx . send ( " And so it begins... \n Use `.rpg class <1- " + str ( len ( rpg_utils . classes ) ) + " >` to select a player class from the following list: \n ` " + " , " . join ( rpg_utils . classes ) + " ` " )
@bot.command ( name = ' class ' )
async def _class ( ctx , number ) :
player = rpg_utils . getplayer ( ctx . author )
if player . _can_change_class :
if number . isDigit ( ) and int ( number ) < len ( rpg_utils . classes ) and int ( number ) > = 1 :
player . _can_change_class = False
player . _class = rpg_utils . classes [ int ( number ) + 1 ]
ctx . send ( " Successfully set your class to ** " + player . _class + " .** " )
else :
ctx . send ( " Invalid arguments! Try providing a number, 1- " + str ( len ( rpg_utils . classes ) ) + " . " )
else :
ctx . send ( " You can ' t change your class right now. \n Current class: " + player . _class )
2019-04-15 09:15:26 -07:00
token = " "
2019-04-15 09:12:56 -07:00
2019-04-15 09:15:26 -07:00
with open ( " token.cfg " ) as f :
2019-04-15 09:17:17 -07:00
token = f . readlines ( ) [ 0 ]
2019-04-15 09:15:26 -07:00
bot . run ( token )
2019-04-15 09:12:56 -07:00