def on_message(message): global dota_players # Everyone's commands words = message.content.lower() if (words.startswith('!')): print words word = words.split() if word[0] == '!lenny': client.send_message(message.channel, '( ͡° ͜ʖ ͡°)') elif word[0] == '!dickbutt': client.send_message( message.channel, '░░░░░░░░░░░░░░░░░░░░░\n░░░░░░░░░░░░▄▀▀▀▀▄░░░\n░░░░░░░░░░▄▀░░▄░▄░█░░\n░▄▄░░░░░▄▀░░░░▄▄▄▄█░░\n█░░▀▄░▄▀░░░░░░░░░░█░░\n░▀▄░░▀▄░░░░█░░░░░░█░░\n░░░▀▄░░▀░░░█░░░░░░█░░\n░░░▄▀░░░░░░█░░░░▄▀░░░\n░░░▀▄▀▄▄▀░░█▀░▄▀░░░░░\n░░░░░░░░█▀▀█▀▀░░░░░░░\n░░░░░░░░▀▀░▀▀░░░░░░░░' ) elif word[0] == '!dota': if word[1] == 'stats': player = '' if len(word) > 3: for i in range(2, len(word)): player += word[i] if i != len(word) - 1: player += ' ' else: player = word[2] response = Dota.dotastats(player, dota_players) elif word[1] == 'counter': hero = '' if len(word) > 3: for i in range(2, len(word)): hero += word[i] if i != len(word) - 1: hero += '-' else: hero = word[2] hero = hero.lower() response = Dota.dotaCounter(hero) client.send_message(message.channel, response) elif word[0] == '!add': if word[1] == 'dotaplayer': if len(word) == 4: dota_players = Dota.addDotaPlayer(word[2], word[3], dota_players) else: client.send_message( message.channel, "ERROR: Incorrect usage.\n\t!add dotaplayer $playername $dotabuff_player_ID" ) elif word[0] == '!help': counter = 0 players = '' for player in dota_players: if counter % 2 == 0: players += player + '\n\t' counter += 1 client.send_message( message.channel, """Current commands:\n\t- !lenny\n\t- !dickbutt\n\t- !dota stats $player\n\t- !dota counter $hero\n\t- !add dotaplayer $username $dotabuff_player_ID\n\t- !wiki $wikiSearchWord(s) \t- !urban $word(s)\n\t- !report @user\n\t- !cummies\n\t- !delete daddy Dota players included:""" + '\n\t' + players) elif word[0] == '!wiki': searchWord = '' if len(word) > 2: for i in range(1, len(word)): searchWord += word[i] if i != len(word) - 1: searchWord += '_' else: searchWord = word[1] client.send_message(message.channel, Fun.wikiSearch(searchWord)) elif word[0] == '!urban': define = '' if len(word) > 2: for i in range(1, len(word)): define += word[i] if i != len(word) - 1: define += ' ' else: define = word[1] client.send_message(message.channel, Fun.urbanSearch(define).encode('utf-8')) elif word[0] == '!report': reported = '' if len(word) > 2: for i in range(1, len(word)): reported += word[i] else: reported = word[1] reportedAlt = reported[2:len(reported) - 1] f = open(message.server.name + ' reports.txt', 'r') user_array = {} for line in f: line = line.decode('utf-8') line = line.split(',') user_array[line[1]] = [line[0], line[2].rstrip('\n')] f.close() #print 'Reported: ' + user_array[reportedAlt][0] if reportedAlt in user_array: user_array[reportedAlt][1] = int( user_array[reportedAlt][1]) + 1 f = open(message.server.name + ' reports.txt', 'wb') for key, value in user_array.items(): f.write(value[0].encode('utf-8') + ',' + key.encode('utf-8') + ',' + str(value[1]) + '\n') client.send_message( message.channel, 'Reported ' + user_array[reportedAlt][0].encode('utf-8') + '. Current Reports: ' + str(user_array[reportedAlt][1])) f.close() else: client.send_message( message.channel, reported + ' does not exist as a user in this server.') elif word[0] == '!roll': if len(word) == 2: client.send_message(message.channel, Fun.roll(word[1])) else: client.send_message(message.channel, Fun.roll()) elif word[0] == '!cummies': client.send_message(message.channel, Fun.cummies()) elif word[0] == '!delete' and word[1] == 'daddy': client.send_message(message.channel, Fun.daddy()) elif word[0] == '!checkem': response = Fun.checkem() client.send_message(message.channel, response) elif word[0] == '!rps': if rock_queue == 0: firstPlayer = message.author.name client.send_message( message.channel, "%s is playing Rock Paper Scissors, need 1 more player." % firstPlayer) rock_queue = 1 elif rock_queue == 1: secondPlayer = message.author.name client.send_message(message.channel, "%s has joined the game." % secondPlayer) client.send_message(message.channel, "Rock. Paper. Scissors!") client.send_message(message.channel, Fun.rps(firstPlayer, secondPlayer)) rock_queue = 0 #baseURL = https://api.steampowered.com/IDOTA2Match_570/ # Calum's commands #if message.author.name == '1nsayn': # Steam ID: 76561198066749272 # Tibor's commands #if message.author.name == 'robit': # Steam ID: 76561197996963851 # Michael's commands #if message.author.name == 'Lekcian': # Steam ID: 76561197991432811 if message.author.name == 'MoySauce': if message.content == '!logout': client.send_message(message.channel, 'Bot has logged out') client.logout()
def on_message(message): global dota_players global game_list global rock_queue global firstPlayer global secondPlayer # Everyone's commands words = message.content.lower() if (words.startswith('!')): print words word = words.split() if word[0] == '!lenny': client.send_message(message.channel, '( ͡° ͜ʖ ͡°)') if word[0] == '!rekt': x = Fun.roll(1) if x == 1: client.send_message(message.channel, '☐ Not REKT ☑ REKT') if x == 0: client.send_message(message.channel, '☑ Not REKT ☐ REKT') if word[0] == '!checkem': client.send_message(message.channel, Fun.checkEm()) elif word[0] == '!rps': if rock_queue == 0: firstPlayer = message.author.name client.send_message(message.channel, "%s is playing Rock Paper Scissors, need 1 more player." % firstPlayer) rock_queue = 1 elif rock_queue == 1: secondPlayer = message.author.name client.send_message(message.channel, "%s has joined the game." % secondPlayer) client.send_message(message.channel, "Rock. Paper. Scissors!") client.send_message(message.channel, Fun.rps(firstPlayer, secondPlayer)) rock_queue = 0 elif word[0] == '!dickbutt': client.send_message(message.channel, '░░░░░░░░░░░░░░░░░░░░░\n░░░░░░░░░░░░▄▀▀▀▀▄░░░\n░░░░░░░░░░▄▀░░▄░▄░█░░\n░▄▄░░░░░▄▀░░░░▄▄▄▄█░░\n█░░▀▄░▄▀░░░░░░░░░░█░░\n░▀▄░░▀▄░░░░█░░░░░░█░░\n░░░▀▄░░▀░░░█░░░░░░█░░\n░░░▄▀░░░░░░█░░░░▄▀░░░\n░░░▀▄▀▄▄▀░░█▀░▄▀░░░░░\n░░░░░░░░█▀▀█▀▀░░░░░░░\n░░░░░░░░▀▀░▀▀░░░░░░░░') elif word[0] == '!roll': if len(word) == 2: # word = [int(i)for i in word] client.send_message(message.channel, Fun.roll((word[1]))) else: client.send_message(message.channel, Fun.roll()) elif word[0] == '!dota': if word[1] == 'stats': player = '' if len(word) > 3: for i in range(2, len(word)): player += word[i] if i != len(word)-1: player += ' ' else: player = word[2] response = Dota.dotastats(player, dota_players) elif word[1] == 'counter': hero = '' if len(word) > 3: for i in range(2, len(word)): hero += word[i] if i != len(word)-1: hero += '-' else: hero = word[2] hero = hero.lower() response = Dota.dotaCounter(hero) client.send_message(message.channel, response) elif word[0] == '!add': if word[1] == 'dotaplayer': if len(word) == 4: dota_players = Dota.addDotaPlayer(word[2], word[3], dota_players) else: client.send_message(message.channel, "ERROR: Incorrect usage.\n\t!add dotaplayer $playername $dotabuff_player_ID") elif word[0] == '!rollthedice': client.send_message(message.channel, Fun.rollTheDice(game_list)) elif word[0] == '!games': client.send_message(message.channel, game_list) elif word[0] == '!help': counter = 0 players = '' for player in dota_players: if counter % 2 == 0: players += player + '\n\t' counter += 1 client.send_message(message.channel, """Current commands:\n\t- !lenny\n\t- !dickbutt\n\t- !dota stats $player\n\t- !dota counter $hero\n\t- !add dotaplayer $username $dotabuff_player_ID\n\t- !wiki $wikiSearchWord(s) \t- !urban $word(s)\n\t- !report @user Dota players included:""" + '\n\t' + players) elif word[0] == '!wiki': searchWord = '' if len(word) > 2: for i in range(1, len(word)): searchWord += word[i] if i != len(word)-1: searchWord += '_' else: searchWord = word[1] client.send_message(message.channel, Fun.wikiSearch(searchWord)) elif word[0] == '!urban': define = '' if len(word) > 2: for i in range(1, len(word)): define += word[i] if i != len(word)-1: define += ' ' else: define = word[1] client.send_message(message.channel, Fun.urbanSearch(define).encode('utf-8')) elif word[0] == '!report': reported = '' if len(word) > 2: for i in range(1, len(word)): reported += word[i] else: reported = word[1] reportedAlt = reported[2:len(reported)-1] f = open(message.server.name + ' reports.txt', 'r') user_array = {} for line in f: line = line.decode('utf-8') line = line.split(',') user_array[line[1]] = [line[0],line[2].rstrip('\n')] f.close() #print 'Reported: ' + user_array[reportedAlt][0] if reportedAlt in user_array: user_array[reportedAlt][1] = int(user_array[reportedAlt][1]) + 1 f = open(message.server.name + ' reports.txt', 'wb') for key, value in user_array.items(): f.write(value[0].encode('utf-8') + ',' + key.encode('utf-8') + ',' + str(value[1]) + '\n') client.send_message(message.channel, 'Reported ' + user_array[reportedAlt][0].encode('utf-8') + '. Current Reports: ' + str(user_array[reportedAlt][1])) f.close() else: client.send_message(message.channel, reported + ' does not exist as a user in this server.') #baseURL = https://api.steampowered.com/IDOTA2Match_570/ # Calum's commands #if message.author.name == '1nsayn': # Steam ID: 76561198066749272 # Tibor's commands #if message.author.name == 'robit': # Steam ID: 76561197996963851 # Michael's commands #if message.author.name == 'Lekcian': # Steam ID: 76561197991432811 if message.author.name == 'Mokio' or message.author.name == 'MoySauce': if message.content == '!logout': client.send_message(message.channel, 'Bot has logged out') client.logout() elif word[0] == '!add': if word[1] == 'game': define = '' if len(word) > 3: for i in range(3, len(word)): define += word[i] if i != len(word)-1: define += ' ' if len(word) == 3: game_list = Fun.addGame(word[2], game_list) client.send_message(message.channel, "%s was added to the list" % word[2]) else: client.send_message(message.channel, "ERROR: you f****d up.")
def on_message(message): global dota_players # Everyone's commands words = message.content.lower() if (words.startswith('!')): print words word = words.split() if word[0] == '!lenny': client.send_message(message.channel, '( ͡° ͜ʖ ͡°)') elif word[0] == '!dickbutt': client.send_message(message.channel, '░░░░░░░░░░░░░░░░░░░░░\n░░░░░░░░░░░░▄▀▀▀▀▄░░░\n░░░░░░░░░░▄▀░░▄░▄░█░░\n░▄▄░░░░░▄▀░░░░▄▄▄▄█░░\n█░░▀▄░▄▀░░░░░░░░░░█░░\n░▀▄░░▀▄░░░░█░░░░░░█░░\n░░░▀▄░░▀░░░█░░░░░░█░░\n░░░▄▀░░░░░░█░░░░▄▀░░░\n░░░▀▄▀▄▄▀░░█▀░▄▀░░░░░\n░░░░░░░░█▀▀█▀▀░░░░░░░\n░░░░░░░░▀▀░▀▀░░░░░░░░') elif word[0] == '!dota': if word[1] == 'stats': player = '' if len(word) > 3: for i in range(2, len(word)): player += word[i] if i != len(word)-1: player += ' ' else: player = word[2] response = Dota.dotastats(player, dota_players) elif word[1] == 'counter': hero = '' if len(word) > 3: for i in range(2, len(word)): hero += word[i] if i != len(word)-1: hero += '-' else: hero = word[2] hero = hero.lower() response = Dota.dotaCounter(hero) client.send_message(message.channel, response) elif word[0] == '!add': if word[1] == 'dotaplayer': if len(word) == 4: dota_players = Dota.addDotaPlayer(word[2], word[3], dota_players) else: client.send_message(message.channel, "ERROR: Incorrect usage.\n\t!add dotaplayer $playername $dotabuff_player_ID") elif word[0] == '!help': counter = 0 players = '' for player in dota_players: if counter % 2 == 0: players += player + '\n\t' counter += 1 client.send_message(message.channel, """Current commands:\n\t- !lenny\n\t- !dickbutt\n\t- !dota stats $player\n\t- !dota counter $hero\n\t- !add dotaplayer $username $dotabuff_player_ID\n\t- !wiki $wikiSearchWord(s) \t- !urban $word(s)\n\t- !report @user Dota players included:""" + '\n\t' + players) elif word[0] == '!wiki': searchWord = '' if len(word) > 2: for i in range(1, len(word)): searchWord += word[i] if i != len(word)-1: searchWord += '_' else: searchWord = word[1] client.send_message(message.channel, Fun.wikiSearch(searchWord)) elif word[0] == '!urban': define = '' if len(word) > 2: for i in range(1, len(word)): define += word[i] if i != len(word)-1: define += ' ' else: define = word[1] client.send_message(message.channel, Fun.urbanSearch(define).encode('utf-8')) elif word[0] == '!report': reported = '' if len(word) > 2: for i in range(1, len(word)): reported += word[i] else: reported = word[1] reportedAlt = reported[2:len(reported)-1] f = open(message.server.name + ' reports.txt', 'r') user_array = {} for line in f: line = line.decode('utf-8') line = line.split(',') user_array[line[1]] = [line[0],line[2].rstrip('\n')] f.close() #print 'Reported: ' + user_array[reportedAlt][0] if reportedAlt in user_array: user_array[reportedAlt][1] = int(user_array[reportedAlt][1]) + 1 f = open(message.server.name + ' reports.txt', 'wb') for key, value in user_array.items(): f.write(value[0].encode('utf-8') + ',' + key.encode('utf-8') + ',' + str(value[1]) + '\n') client.send_message(message.channel, 'Reported ' + user_array[reportedAlt][0].encode('utf-8') + '. Current Reports: ' + str(user_array[reportedAlt][1])) f.close() else: client.send_message(message.channel, reported + ' does not exist as a user in this server.') #baseURL = https://api.steampowered.com/IDOTA2Match_570/ # Calum's commands #if message.author.name == '1nsayn': # Steam ID: 76561198066749272 # Tibor's commands #if message.author.name == 'robit': # Steam ID: 76561197996963851 # Michael's commands #if message.author.name == 'Lekcian': # Steam ID: 76561197991432811 if message.author.name == 'MoySauce': if message.content == '!logout': client.send_message(message.channel, 'Bot has logged out') client.logout()