Merge branch 'main' of https://github.com/notBscalE/BotYam into main

This commit is contained in:
Lucy Joshua 2023-03-10 21:11:10 +02:00
commit 7a2290158b
6 changed files with 67 additions and 16 deletions

19
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,19 @@
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: 22
script: "cd /etc/BotYam && git pull && docker-compose up -d --build"

View file

@ -16,7 +16,11 @@ The DB is used for storing everything in stores, as its credentials are currentl
The API tokens are stored in the API hash, used to communicate with Twitter API. The API tokens are stored in the API hash, used to communicate with Twitter API.
!!! warning "Twitter API License Changes" !!! warning "Twitter API License Changes"
Currently, the bot is operating under the Twitter API Elevated Access.<br>On February 9th, new changes for the API access that has been announced will come into effect, and currently there isn't a guarantee that the bot will be up after the changes will be applied.<br> Currently, the bot is operating under the Twitter API Elevated Access.
On February 9th, new changes for the API access that has been announced will come into effect, and currently there isn't a guarantee that the bot will be up after the changes will be applied.
Please follow `@FromBotYam` for updates. Please follow `@FromBotYam` for updates.
## The Data Structure ## The Data Structure

View file

@ -3,7 +3,11 @@
Welcome to the Bot Yam documentation, to ultimate source of knowledge when it comes about the bot, using the handle @FromBotYam. Welcome to the Bot Yam documentation, to ultimate source of knowledge when it comes about the bot, using the handle @FromBotYam.
!!! warning "Twitter API License Changes" !!! warning "Twitter API License Changes"
Currently, the bot is operating under the Twitter API Elevated Access.<br>On February 9th, new changes for the API access that has been announced will come into effect, and currently there isn't a guarantee that the bot will be up after the changes will be applied.<br> Currently, the bot is operating under the Twitter API Elevated Access.
On February 9th, new changes for the API access that has been announced will come into effect, and currently there isn't a guarantee that the bot will be up after the changes will be applied.
Please follow `@FromBotYam` for updates. Please follow `@FromBotYam` for updates.
Here you can have the syntax menu, but also read some information for nerds. Here you can have the syntax menu, but also read some information for nerds.
@ -19,10 +23,11 @@ Here you can have the syntax menu, but also read some information for nerds.
### Credits ### Credits
All jokes and videos are accumulated and edited by Lucy Joshua, except: All jokes and videos are accumulated and edited by Lucy Joshua, except:
- "I'm From Bat Yam" - Aviv Yashar (@aviv_yashar) - "I'm From Bat Yam" - Aviv Yashar (@aviv_yashar)
- "Gebels" - Aviv Yashar (@aviv_yashar) - "Gebels" - Aviv Yashar (@aviv_yashar)
- "Vodka Redbull/Misadot" - Lindi (@lindi_orginal) - "Vodka Redbull/Misadot" - Lindi (@lindi_orginal)
- "Misadot Re-enactment" - Kai Mairone (@KaiMairone) - "Misadot Re-enactment" - Kai Mairone (@KaiMairone)
### License ### License
The project is protected under the GNU GPLv3. For more information, visit the [license page](license.md).<br>Please read if you conside contributing. The project is protected under the GNU GPLv3. For more information, visit the [license page](license.md).<br>Please read if you conside contributing.

View file

@ -19,6 +19,7 @@ Victims
If you're included in the victims list, a random number generator will decide if an automated response will be posted, with an additional message. If you're included in the victims list, a random number generator will decide if an automated response will be posted, with an additional message.
The victims currently are: The victims currently are:
- Lucy Joshua (@LucyBscalE) - Lucy Joshua (@LucyBscalE)
- Stav Raz (@StevenRaz5) - Stav Raz (@StevenRaz5)
- Aviv Yashar (@aviv_yashar) - Aviv Yashar (@aviv_yashar)
@ -27,14 +28,17 @@ The victims currently are:
- Shauli Greenfeld (@shaulig) - Shauli Greenfeld (@shaulig)
- Nir Hauschner (@nir_hau) - Nir Hauschner (@nir_hau)
!! note "Join the victim list!"
Wanna be a part of the list? Ask us in our DMs and you'll get there! !!! note "Join the victim list!"
Wanna be a part of the list? Ask us in our DMs and you'll get there!
The optional responses added to the post: The optional responses added to the post:
- "שלום קורבן" - "שלום קורבן"
- "אי אפשר לברוח מהחרא הזה אה" - "אי אפשר לברוח מהחרא הזה אה"
- "מה קורה כפרה" - "מה קורה כפרה"
For example: For example:
<blockquote class="twitter-tweet"><p lang="iw" dir="rtl">אי אפשר לברוח מהחרא הזה אה<br>ואחחחחח בפרק הקודם <a href="https://t.co/1hudYy1Zyq">pic.twitter.com/1hudYy1Zyq</a></p>&mdash; אני מבוט-ים (@FromBotYam) <a href="https://twitter.com/FromBotYam/status/1621689770031157250?ref_src=twsrc%5Etfw">February 4, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <blockquote class="twitter-tweet"><p lang="iw" dir="rtl">אי אפשר לברוח מהחרא הזה אה<br>ואחחחחח בפרק הקודם <a href="https://t.co/1hudYy1Zyq">pic.twitter.com/1hudYy1Zyq</a></p>&mdash; אני מבוט-ים (@FromBotYam) <a href="https://twitter.com/FromBotYam/status/1621689770031157250?ref_src=twsrc%5Etfw">February 4, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
@ -184,8 +188,12 @@ None
``` ```
!!! note !!! note
Yep. That's right.<br>If you'll tag `@FromBotYam` with nothing on, you'll get the tilt gag.<br>You have been warned. Yep. That's right.
If you'll tag `@FromBotYam` with nothing on, you'll get the tilt gag.
You have been warned.
**The possible replies**: **The possible replies**:
<blockquote class="twitter-tweet" data-conversation="none"><p lang="iw" dir="rtl">סרבאאאקקקקקקק <a href="https://t.co/pnh4jveVRH">pic.twitter.com/pnh4jveVRH</a></p>&mdash; אני מבוט-ים (@FromBotYam) <a href="https://twitter.com/FromBotYam/status/1620403511102930945?ref_src=twsrc%5Etfw">January 31, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <br> <blockquote class="twitter-tweet" data-conversation="none"><p lang="iw" dir="rtl">סרבאאאקקקקקקק <a href="https://t.co/pnh4jveVRH">pic.twitter.com/pnh4jveVRH</a></p>&mdash; אני מבוט-ים (@FromBotYam) <a href="https://twitter.com/FromBotYam/status/1620403511102930945?ref_src=twsrc%5Etfw">January 31, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <br>
<blockquote class="twitter-tweet" data-conversation="none"><p lang="iw" dir="rtl">חלאססססס <a href="https://t.co/uwm7wovnBA">pic.twitter.com/uwm7wovnBA</a></p>&mdash; אני מבוט-ים (@FromBotYam) <a href="https://twitter.com/FromBotYam/status/1620356451121201153?ref_src=twsrc%5Etfw">January 31, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <blockquote class="twitter-tweet" data-conversation="none"><p lang="iw" dir="rtl">חלאססססס <a href="https://t.co/uwm7wovnBA">pic.twitter.com/uwm7wovnBA</a></p>&mdash; אני מבוט-ים (@FromBotYam) <a href="https://twitter.com/FromBotYam/status/1620356451121201153?ref_src=twsrc%5Etfw">January 31, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

View file

@ -20,15 +20,30 @@ def post_reply(conn, victim_bank, tweet, words, reply_text_bank, postcounter):
if any(word in tweet.data['text'] for word in words): if any(word in tweet.data['text'] for word in words):
reply_text = reply_text_bank[random.randint(0, (len(reply_text_bank)-1))] reply_text = reply_text_bank[random.randint(0, (len(reply_text_bank)-1))]
# Post reply # Post reply
if tweet.data['author_id'] in victim_bank['author_id'] and not "@FromBotYam" in tweet.data['text']: try:
reply_text = victim_bank['reply'][random.randint(0,2)] + "\nו" + reply_text if tweet.data['author_id'] in victim_bank['author_id'] and not "@FromBotYam" in tweet.data['text']:
res = conn.api.create_tweet( reply_text = victim_bank['reply'][random.randint(0,2)] + "\nו" + reply_text
text=reply_text, res = conn.api.create_tweet(
in_reply_to_tweet_id=tweet["id"] text=reply_text,
) in_reply_to_tweet_id=tweet["id"]
)
except tweepy.errors.TwitterServerError as e:
print("ERROR: An error occured, we'll try again in a few minutes. The error: " + str(e))
try:
if tweet.data['author_id'] in victim_bank['author_id'] and not "@FromBotYam" in tweet.data['text']:
reply_text = victim_bank['reply'][random.randint(0,2)] + "\nו" + reply_text
res = conn.api.create_tweet(
text=reply_text,
in_reply_to_tweet_id=tweet["id"]
)
response_data = f"RESPONDING: {res.data['text']}"
print(response_data)
except Exception as e:
print("ERROR: An exception occured. The error: " + str(e))
except Exception as e:
print("ERROR: An exception occured. The error: " + str(e))
postcounter = postcounter + 1 postcounter = postcounter + 1
response_data = f"RESPONDING: {res.data['text']}"
print(response_data)
return postcounter return postcounter
class BotYamPoster(tweepy.StreamingClient): class BotYamPoster(tweepy.StreamingClient):

View file

@ -5,7 +5,7 @@ from BotYamPoster import init_streamobject
from connector import Connector from connector import Connector
def main(): def main():
print("BOT-YAM - VERSION 3.0.1 >>>>") print("BOT-YAM - VERSION 3.0.2 >>>>")
conn = Connector() conn = Connector()
stream = init_streamobject(conn) stream = init_streamobject(conn)
print("Adding stream rules...") print("Adding stream rules...")