Adding all combination of uppercase for the trigger word

This commit is contained in:
Mylloon 2021-08-03 21:19:22 +02:00
parent 2231153fc4
commit bb8cfb47b0

23
main.py
View file

@ -42,6 +42,27 @@ def seniority(date: str):
age = datetime.now(timezone('UTC')) - datetimeObject # Time now in UTC minus the time we got to get the age of the date age = datetime.now(timezone('UTC')) - datetimeObject # Time now in UTC minus the time we got to get the age of the date
return False if age.days >= 1 else True # False if older than a day return False if age.days >= 1 else True # False if older than a day
def permute(array: list):
quoi = []
for text in array: # all element of the list
n = len(text)
mx = 1 << n # Number of permutations is 2^n
text = text.lower() # Converting string to lower case
for i in range(mx): # Using all subsequences and permuting them
combination = [k for k in text]
for j in range(n):
if (((i >> j) & 1) == 1): # If j-th bit is set, we convert it to upper case
combination[j] = text[j].upper()
temp = ""
for i in combination:
temp += i
quoi.append(temp)
return quoi
def main(accessToken, accessTokenSecret, consumerKey, consumerSecret, user): def main(accessToken, accessTokenSecret, consumerKey, consumerSecret, user):
"""Main method.""" """Main method."""
auth = OAuthHandler(consumerKey, consumerSecret) auth = OAuthHandler(consumerKey, consumerSecret)
@ -67,7 +88,7 @@ if __name__ == '__main__':
-- --
PSEUDO is the PSEUDO of the account you want to listen to snipe. A proportion of who s.he follow will be targeted. PSEUDO is the PSEUDO of the account you want to listen to snipe. A proportion of who s.he follow will be targeted.
""" """
quoi = ["quoi", "koi"] quoi = permute(["quoi", "koi"])
feur = ["feur", "(feur)", "FEUR", "feur lol"] feur = ["feur", "(feur)", "FEUR", "feur lol"]
friends = [] friends = []
keys = load(["TOKEN", "TOKEN_SECRET", "CONSUMER_KEY", "CONSUMER_SECRET", "PSEUDO"]) keys = load(["TOKEN", "TOKEN_SECRET", "CONSUMER_KEY", "CONSUMER_SECRET", "PSEUDO"])