Compare commits
No commits in common. "68144b56ca9840afdb740a2821edbe66b4173bb4" and "c8db7f6436474970e13093c4b9e22ee88157fdf4" have entirely different histories.
68144b56ca
...
c8db7f6436
3 changed files with 15 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
|||
TOKEN=
|
||||
TOKEN_SECRET=
|
||||
CONSUMER_KEY=
|
||||
CONSUMER_SECRET=
|
||||
BEARER_TOKEN=
|
||||
TOKEN=
|
||||
TOKEN_SECRET=
|
||||
PSEUDO=
|
||||
|
|
|
@ -39,11 +39,11 @@ docker build https://git.kennel.ml/Anri/feurBot.git#main --tag feurbot:main && \
|
|||
docker run -d \
|
||||
--name="feurBot" \
|
||||
feurbot:main \
|
||||
--TOKEN="" \
|
||||
--TOKEN_SECRET="" \
|
||||
--CONSUMER_KEY="" \
|
||||
--CONSUMER_SECRET="" \
|
||||
--BEARER_TOKEN="" \
|
||||
--TOKEN="" \
|
||||
--TOKEN_SECRET="" \
|
||||
--PSEUDOS=""
|
||||
```
|
||||
Ou avec un `docker-compose.yml` :
|
||||
|
@ -54,11 +54,11 @@ services:
|
|||
build: https://git.kennel.ml/Anri/feurBot.git#main
|
||||
container_name: feurBot
|
||||
environment:
|
||||
- TOKEN=
|
||||
- TOKEN_SECRET=
|
||||
- CONSUMER_KEY=
|
||||
- CONSUMER_SECRET=
|
||||
- BEARER_TOKEN=
|
||||
- TOKEN=
|
||||
- TOKEN_SECRET=
|
||||
- PSEUDOS=
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
|
17
main.py
17
main.py
|
@ -1,4 +1,5 @@
|
|||
from datetime import datetime
|
||||
from json import loads
|
||||
from os import environ
|
||||
from random import choice
|
||||
from re import findall, sub
|
||||
|
@ -183,8 +184,7 @@ class Listener(StreamingClient):
|
|||
if keys["VERBOSE"]:
|
||||
print("En attente de reconnexion...")
|
||||
case _:
|
||||
# newline
|
||||
print("")
|
||||
print("\n")
|
||||
return False
|
||||
|
||||
|
||||
|
@ -194,7 +194,7 @@ def repeater(word: str) -> str:
|
|||
# Explanation: Trigger word for the repeater is "di" and sometimes it is
|
||||
# "dis", sometimes its "dit", that's why we need to remove this 2 letters
|
||||
# from the final answer
|
||||
if word[0] == "s" or word[0] == "t":
|
||||
if word[0] == 's' or word[0] == 't':
|
||||
word = word[1:]
|
||||
|
||||
# Random format from the base answer
|
||||
|
@ -249,25 +249,26 @@ def createClient(consumer_key, consumer_secret, access_token, access_token_secre
|
|||
|
||||
if keys["VERBOSE"]:
|
||||
try:
|
||||
client.get_me().data.username
|
||||
print(
|
||||
f"Authentification réussie en tant que @{client.get_me().data.username}.\n")
|
||||
|
||||
# Compte ignorés
|
||||
if keys["WHITELIST"] == []:
|
||||
if keys['WHITELIST'] == []:
|
||||
whitelist = "Aucun"
|
||||
else:
|
||||
whitelist = f"@{', @'.join(keys['WHITELIST'])}"
|
||||
print(f"Liste des comptes ignorés : {whitelist}.")
|
||||
|
||||
# Compte forcés
|
||||
if keys["FORCELIST"] == []:
|
||||
if keys['FORCELIST'] == []:
|
||||
forcelist = "Aucun"
|
||||
else:
|
||||
forcelist = f"@{', @'.join(keys['FORCELIST'])}"
|
||||
print(f"Liste des comptes forcés : {forcelist}.")
|
||||
|
||||
# Compte aux following suivis
|
||||
if keys["PSEUDOS"] == []:
|
||||
if keys['PSEUDOS'] == []:
|
||||
pseudos = "Aucun"
|
||||
else:
|
||||
pseudos = f"@{', @'.join(keys['PSEUDOS'])}"
|
||||
|
@ -288,7 +289,7 @@ def create_rules(tracked_users: list[str]) -> list[str]:
|
|||
rules = []
|
||||
|
||||
# Repeating rules
|
||||
repeat = "-is:retweet lang:fr ("
|
||||
repeat = "-is:retweet ("
|
||||
|
||||
# Buffer
|
||||
buffer = repeat
|
||||
|
@ -339,7 +340,7 @@ def start():
|
|||
# Add new rules
|
||||
stream.add_rules([StreamRule(rule)
|
||||
for rule in create_rules(tracked_users)])
|
||||
stream.filter(threaded=True, tweet_fields="author_id")
|
||||
stream.filter(threaded=True, tweet_fields=['author_id'])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Reference in a new issue