diff --git a/api.py b/api.py index d6c8c56..dcb1d5e 100644 --- a/api.py +++ b/api.py @@ -4,101 +4,4 @@ client = discord.Client() token = 'Nzc2ODIzNzU0MDA0NDk2NDQ1.X66ffw.XOxA0IHsRdEBjkyvThwCo-DTCCM' - -class Flag: - counter = 0 - - -# Lists -user1 = ['hi', 'hello', 'hey','heyy','heyyy','hey there', 'what\'s up', 'good morning', 'good afternoon', 'good evening', 'whatup','yo whatup'] -discord1 = 'hey! hope you\'re having a good day, i\'m your vacation chatbot, i\'ll help you choose a holiday destination, let\'s start? ' - -user2 = ['yeah','yeah sure','yes','sure','why not','yup','yeah go on','yeap'] -discord2 = "Great! so which continent you\'d like to go to?" - -discord3 = 'following are the top countries/places in {}:' - -asia = ['Japan','Singapore','China','South Korea','India'] -europe = ['Spain','NetherLands','Italy','Belgium','Croatia'] -africa = ['Egypt','Kenya','South Africa','Morocco','Sychelles'] -north_america = ['USA','Mexico','Canada','Dominican Republic','Cuba'] -south_america = ['Ecuador','Colombia','Peru','Chile','Bolivia'] -antarctica = ['Antarctic Peninsula', 'South Shetland Islands','Drake Passage','Falkland Islands','South Georgia'] -oceania = ['Fiji','Tahiti','Palau'] - -@client.event -async def on_ready(): - print('logged in as {0.user}'.format(client)) - - -@client.event -async def on_message(message): - messages = message.content.lower() # to handle input from the user in discord - - response = message.channel.send # required to invoke response from bot - - if message.author == client.user: - return - - if messages in user1 and Flag.counter == 0: # initial greetings - Flag.counter = 1 - await response(discord1) - - - elif messages in user2 and Flag.counter == 1: # first response - Flag.counter = 2 - await response(discord2) - - elif 'asia' in messages and Flag.counter == 2: # asia - await response(discord3.format(messages)) - for i in range(len(asia)): - name = str(asia[i]) - await response(name) - - - elif 'europe' in messages and Flag.counter == 2: # europe - await response(discord3.format(messages)) - for i in range(len(europe)): - name = str(europe[i]) - await response(name) - - - elif 'africa' in messages and Flag.counter == 2: # africa - await response(discord3.format(messages)) - for i in range(len(africa)): - name = str(africa[i]) - await response(name) - - - elif 'north' in messages and Flag.counter == 2: # north america - await response(discord3.format(messages)) - for i in range(len(north_america)): - name = str(north_america[i]) - await response(name) - - - elif 'south' in messages and Flag.counter == 2: # south america - await response(discord3.format(messages)) - for i in range(len(south_america)): - name = str(south_america[i]) - await response(name) - - elif 'antarctica' in messages and Flag.counter == 2: # antarctica - await response(discord3.format(messages)) - for i in range(len(antarctica)): - name = str(antarctica[i]) - await response(name) - - - elif 'oceania' in messages and Flag.counter == 2: # oceania - await response(discord3.format(messages)) - for i in range(len(oceania)): - name = str(oceania[i]) - await response(name) - - - else: - await response('sorry i didn\'t understand, can you type again? make sure you dont use numbers') - - client.run(token)