uwu commits sus side
This commit is contained in:
commit
dec8508ee6
|
@ -0,0 +1,2 @@
|
|||
# Python Uwuifying bot for Telegram
|
||||
Quiet basic but does the job for uhm reasons
|
|
@ -0,0 +1,63 @@
|
|||
import requests
|
||||
import time
|
||||
import re
|
||||
import csv
|
||||
from datetime import datetime
|
||||
|
||||
# Rweplwace witwwh ywowowurw Twelwegrwam bowotw twowoken
|
||||
TOKEN = ''
|
||||
|
||||
# Stwowop twwhe bowotw frwowom swendwing messwages owon rwepeatw andw owonlwyw twwhe lwatwestw owonywes
|
||||
latest_message_id = 0
|
||||
latest_update_id = 0
|
||||
|
||||
# Getw twwhe curwrwentw dwatwe andw twime foworw twwhe lwowog filwes
|
||||
date =datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
|
||||
|
||||
# Make twwhe filwe foworw twwhe lwowogs
|
||||
log_file = open(f'uwu{date}.log', 'a', newline='')
|
||||
csv_writer = csv.writer(log_file)
|
||||
|
||||
# Baswicalwlwyw make an infintwe lwowoowop twowo check foworw nywew messwages
|
||||
while True:
|
||||
# Check foworw nywew messwages owon twelwegrwams bowotw api
|
||||
response = requests.get(f'https://api.telegram.org/bot{TOKEN}/getUpdates', params={'offset': latest_update_id+1}).json()
|
||||
|
||||
# Prwowocess each messwage itw getws lwistw
|
||||
for result in response['result']:
|
||||
# Check if twwhe updwatwe is a nywew messwage andw has twextw andw chatw IDw swowo itw can rweplwyw brwuh
|
||||
if 'message' in result and 'text' in result['message'] and 'chat' in result['message'] and 'id' in result['message']['chat']:
|
||||
chat_id = result['message']['chat']['id']
|
||||
message_id = result['message']['message_id']
|
||||
|
||||
# If twwhe messwage IDw is grweatwerw twwhan twwhe lwatwestw messwage IDw we'vwe prwowocesswedw... owo uWuifyw twwhe messwage andw swendw itw back twowo twwhe uswerw
|
||||
if message_id > latest_message_id:
|
||||
uwu_message = result['message']['text']
|
||||
uwu_message = re.sub(r'([rRlL])', r'\1w', uwu_message)
|
||||
uwu_message = re.sub(r'([oO])', r'owo', uwu_message)
|
||||
uwu_message = re.sub(r'([nN])([aeiouAEIOU])', r'\1y\2', uwu_message)
|
||||
uwu_message = re.sub(r'([aeiou])u', r'\1wu', uwu_message)
|
||||
uwu_message = re.sub(r'ove', r'uv', uwu_message)
|
||||
uwu_message = re.sub(r'([lLrR])([aeiouAEIOU])', r'\1w\2', uwu_message)
|
||||
uwu_message = re.sub(r'([sS])([aeiouAEIOU])', r'\1w\2', uwu_message)
|
||||
uwu_message = re.sub(r'([tT])([hH])', r'\1w\2', uwu_message)
|
||||
uwu_message = re.sub(r'([tT])', r'\1w', uwu_message)
|
||||
uwu_message = re.sub(r'([dD])', r'\1w', uwu_message)
|
||||
uwu_message = re.sub(r'([vV])', r'\1w', uwu_message)
|
||||
uwu_message = re.sub(r'([nN])\'([tT])', r'\1o\2', uwu_message)
|
||||
uwu_message = re.sub(r'([nN])\'([dD])', r'\1o\2', uwu_message)
|
||||
uwu_message = re.sub(r'([nN])\'', r'\1y', uwu_message)
|
||||
uwu_message = re.sub(r'([yY])', r'\1w', uwu_message)
|
||||
uwu_message = re.sub(r'!', r'! >w<', uwu_message)
|
||||
uwu_message = re.sub(r'\?', r'? OwO', uwu_message)
|
||||
uwu_message = re.sub(r'[.,:;]', r'... owo', uwu_message)
|
||||
|
||||
response = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendMessage', data={'chat_id': chat_id, 'text': uwu_message, 'reply_to_message_id': message_id})
|
||||
|
||||
# Lwowog twwhe messwage andw uWuifiedw messwage twowo twwhe CSVw filwe
|
||||
csv_writer.writerow([result['update_id'], message_id, chat_id, result['message']['text'], uwu_message])
|
||||
latest_message_id = message_id
|
||||
latest_update_id = result['update_id']
|
||||
|
||||
# Waitw foworw 1 swecowondw befoworwe checking foworw nywew updwatwes again swowo we dwowontw spam rwequestws
|
||||
time.sleep(1)
|
Loading…
Reference in New Issue