Skip to content
Permalink
Browse files
acieve function works with steamID and gameID functions
  • Loading branch information
lycette2 committed Nov 22, 2020
1 parent 9c8c1bb commit 5f3b3a8f052484c1afcd82d37754adc363136495
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
BIN +0 Bytes (100%) .vs/Chatbot/v16/.suo
Binary file not shown.
BIN +0 Bytes (100%) .vs/slnx.sqlite
Binary file not shown.
@@ -36,12 +36,11 @@ def botGreeting():
"Hello, thanks for greeting me. I may save you in the bot wars"]
return random.choice(creepyHellos)

def steamAchievementPercentages(discordID, gameName): #Emily
def steamAchievementPercentages(discordID, gameID): #Emily

sharedIDIndex = tempIDArrayDiscord.index(discordID)
steamID = tempIDArraySteam[sharedIDIndex]

gameID = fetchGameID(gameName)

steamID = str(steamID)
gameID = str(gameID)
achieveList= requests.get("http://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid=" +gameID+ "&key=" +steamApiKey+ "&steamid=" +steamID)
@@ -58,7 +57,7 @@ def steamAchievementPercentages(discordID, gameName): #Emily
achieveList = list(achieveList.split("-"))

#this section iterates over the list to find the total achievements
print (achieveList)
#print (achieveList)
for achieve in achieveList:
if "achieved :0" in achieve:
totalAchieves = totalAchieves + 1
@@ -145,6 +144,12 @@ def cheerUpWithCats():
"Some cat pic therapy on the way!"]
return random.choice(reply)

def noSteamIDErrorReplies():
reply = ["Whoops something went wrong, have you given me your Steam ID yet?",
"I am a mere bot and I cannot hack your Steam account to get your ID, unfortunately. I also can't do what you're asking without it",
"I need a steam ID to do that. Looks like I don't have it yet"]
return random.choice(reply)

#================Emily=Function=End============================================

#================BenHB=Function=Start==========================================
@@ -278,18 +283,18 @@ async def on_message(message): #checks for a message
#if [entry for entry in achievementWords if(entry in message.content.lower())]:

if "steam" in message.content.lower() and [entry for entry in achievementWords if(entry in message.content.lower())]:
await message.channel.send(steamAchievementPercentages(registerSteamID(message.author.id, message.content[message.content.find('(') +1 :message.content.find(')')])))
try:
await message.channel.send(steamAchievementPercentages(message.author.id, fetchGameID(message.content)))
except:
await message.channel.send(noSteamIDErrorReplies())


banWords = ["banned", "ban", "bans"]
if "steam" in message.content.lower() and [entry for entry in banWords if(entry in message.content.lower())]:
try:
await message.channel.send(isUserBanned(message.author.id))
except:
randomSteamIDErrorReplies = ["Ben get your SteamId function under control I can't work under these conditions",
"Something went wrong *looks pointedly at Ben*",
"Why it looks like the SteamID function broke down, I wonder why, *Ben*"]
await message.channel.send(random.choice(randomSteamIDErrorReplies))
await message.channel.send(noSteamIDErrorReplies())

if "cat" in message.content.lower():
await message.channel.send(catMessage())

0 comments on commit 5f3b3a8

Please sign in to comment.