Skip to content
Permalink
Browse files
ben did some stuff that I need to pull
  • Loading branch information
masudm6 committed Nov 22, 2020
2 parents 057a18c + 2661dc0 commit 903ee7e951e4855a80d3c82b1622c4043be1d217
Showing 1 changed file with 37 additions and 5 deletions.
@@ -187,6 +187,35 @@ def registerSteamID(message, discordID):
else:
return("To link your steam requires a SteamID64 a guide for which can be found at: https://appuals.com/steam-64-id/")
#SteamID END

#ChangeSteamID START
def changeSteamID(message, discordID): #Changes a registered users steamID to whatever new id they input.
sharedRelationshipIndex = tempIDArrayDiscord.index(discordID)
formattedSteamID = message.lower()
formattedSteamID = formattedSteamID.replace(" ","") #Formats the recieved message into an acceptable form for the program to iterate through
for charNum in range(len(formattedSteamID)):
if charNum == 0:
count = 0
adjacencyStartIndex = 0
currentChar = formattedSteamID[charNum]
if currentChar.isdigit():
count = count + 1
else:
count = 0
adjacencyStartIndex = charNum + 1
if count == 17:
formattedSteamID = formattedSteamID[adjacencyStartIndex:charNum+1]
break
if len(formattedSteamID) == 17 and formattedSteamID.isdigit(): #and formattedSteamID.is_valid(): in the documentation but currently doesn't work
if (formattedSteamID not in tempIDArraySteam):
tempIDArraySteam[sharedRelationshipIndex] = formattedSteamID #This checks if the input steamID is valid and not already present in the database / two sorted lists that simulate a database
return("Thank You! \nI have now changed your SteamID! It is currently registered as " +formattedSteamID)
elif formattedSteamID in tempIDArraySteam:
return("This Steam ID is already taken sorry")
else:
return ("Sorry, I couldn't seem to find the new SteamID")
#ChangeSteamID END

#SpecificGameID START
def fetchGameID(gameName): #This function fetches the appID of specific game on steam based on the name the user inputs
gameName = gameName[gameName.find('(') +1 :gameName.find(')')]#Formats the recieved message so as to only search with text in between the brackets when looking for gameID
@@ -392,12 +421,15 @@ async def on_message(message): #checks for a message

#BenHB Start==================================================================
#These ifs are used to access a function when a user gives a valid input
if ' steamid ' in message.content.lower() or ' steam id ' in message.content.lower() or 'steamid' in message.content.lower() or 'steam id' in message.content.lower():
messageInfo = registerSteamID(message.content, message.author.id)
await message.channel.send(messageInfo)
#Ben did above

if (' steamid ' in message.content.lower() or ' steam id ' in message.content.lower() or 'steamid' in message.content.lower() or 'steam id' in message.content.lower()) and message.author.id not in tempIDArrayDiscord:
output = registerSteamID(message.content, message.author.id)#If for when the users wants to register their SteamID for the first time
await message.channel.send(output)
if (' steamid ' in message.content.lower() or ' steam id ' in message.content.lower() or 'steamid' in message.content.lower() or 'steam id' in message.content.lower()) and 'change' in message.content.lower() and 'my' in message.content.lower() and message.author.id in tempIDArrayDiscord:
output = changeSteamID(message.content, message.author.id)#If for when the user wants to change their SteamID once they have registered
await message.channel.send(output)
if 'displayid ' in message.content.lower():
displayedID = fetchGameID(message.content.replace('displayid ',''))
displayedID = fetchGameID(message.content.replace('displayid ',''))#An if for a test function that returns the Steam gameID of whatever game you put in. Was left in because it's a nice feature
await message.channel.send(displayedID)

if ('play' in message.content.lower() or 'many' in message.content.lower()) and ('time' in message.content.lower() or 'minute' in message.content.lower() or 'day' in message.content.lower() or 'second' in message.content.lower() or 'hour' in message.content.lower() or 'week' in message.content.lower() or 'month' in message.content.lower() or 'year' in message.content.lower()) and message.author.id in tempIDArrayDiscord:

0 comments on commit 903ee7e

Please sign in to comment.