Professional Documents
Culture Documents
Workshop Bot1
Workshop Bot1
STEP 1
move bot.py from your downloads into a folder on your hard drive
( for example UniWork/Programming/Week2/bot.py
STEP 3
Wait while PyCharm creates the project ( can take a few mins )
STEP 4
STEP 5
STEP 7
Click Open... in the le menu and select 'bot.py' from the folder
you downloaded earlier.
Step 8
Step 10
Press run
Step 11
fi
Go to your channel on discord and you should see your bot
like this.
STEP 12
def setup():
return "Exercise 2 "
EXERCISE 3
Write can check your program ins running from your end by using
print( )
def setup():
return "Exercise 3 "
return " You said " + message + " -> " + user
If the user says hello then let us respond with 'nice to meet you'
and their name. Try this code.
def setup():
return "Exercise 4 "
return " You said " + message + " -> " + user
Run the program and check you have got this on your bot
EXERCISE 5
Let us add a second message - if the user says "where am I"
respond with anything ( your call)
def setup():
return "Exercise 2 "
EXERCISE 6
Now it's your turn add a response to respond to "meme" with "I'm 20 days meme free and
counting"
def setup():
return "Exercise 6 "
Run the program and check you have got this on your bot
EXERCISE 7
def setup():
return "Exercise 7 "
EXERCISE 8
def setup():
return "Exercise 8 "
Your turn respond to "hello" , "Hello" or "Hi" with nice to meet you.
EXERCISE 9
Let's respond to the user if they put the words help AND sh any
where in the message. Try this code.
def setup():
return "Exercise 9 "
fi
Try running the code.
EXERCISE 10
def setup():
return "Exercise 10 "
Your turn write "you know the secret word I must praise you" if the
user says "password" and "xyzzy" any where in their message.