21
21
bot_token = os .getenv ('RUDEBOT_TELEGRAM_TOKEN' )
22
22
flood_timeout = int (os .getenv ('RUDEBOT_FLOOD_TIMEOUT' , '10' ))
23
23
destruction_timeout = int (os .getenv ('RUDEBOT_DELETE_TIMEOUT' , '30' ))
24
- database_filename = (os .getenv ('RUDEBOT_DATABASE_FILENAME' , 'db.json' ))
24
+ database_filename = 'data/' + (os .getenv ('RUDEBOT_DATABASE_FILENAME' , 'db.json' ))
25
25
whitelist_chats = os .getenv ('RUDEBOT_ALLOWED_CHATS' , '' )
26
26
27
27
whitelist_chats : list = None if whitelist_chats == '' else [int (chat ) for chat in whitelist_chats .split (',' )]
@@ -93,16 +93,13 @@ def add_or_update_user(user_id: int, username: str, mats_count: int):
93
93
94
94
def get_karma (user_id : int ):
95
95
def size (id : int ):
96
- result = hashlib .md5 (id .to_bytes (8 , 'big' , signed = True )).hexdigest ()
97
- size = int (result , 16 )
98
- size = size % 15 + 7
99
- return size
96
+ return (id + 6 ) % 15 + 7
100
97
101
98
def orientation (id : int ):
102
99
result = hashlib .md5 (id .to_bytes (8 , 'big' , signed = True )).hexdigest ()
103
100
_orientation = int (result , 16 )
104
- _orientation_1 = _orientation % 1
105
- _orientation_2 = _orientation % 5 % 1
101
+ _orientation_1 = _orientation % 3
102
+ _orientation_2 = _orientation % 5 % 2
106
103
return _orientation_1 , _orientation_2
107
104
108
105
user = users [user_id ]
@@ -128,12 +125,10 @@ def orientation(id: int):
128
125
replytext += f"Довжина: `{ user_size } ` сантиметрів, ну і гігант...\n "
129
126
130
127
user_values = orientation (user_id )
131
- orientation_type = ['Латентний' , '' ][user_values [0 ]]
128
+ orientation_type = ['Латентний' , 'Гендерфлюід' , ' ' ][user_values [0 ]]
132
129
orientation_name = ['Android' , 'Apple' ][user_values [0 ]]
133
130
replytext += f"Орієнтація: `{ orientation_type } { orientation_name } ` користувач"
134
131
135
- replytext = replytext .replace ('_' , '\\ _' )
136
-
137
132
return replytext
138
133
139
134
@@ -235,7 +230,7 @@ def read_users():
235
230
with open (database_filename , 'r' , encoding = 'utf-8' ) as f :
236
231
users = eval (f .read ())
237
232
else :
238
- print ("File not exist" )
233
+ print ("File not exist" )
239
234
240
235
241
236
@dp .callback_query_handler (lambda call : call .data == "refresh_top" )
@@ -284,7 +279,7 @@ async def add_group(message: types.Message):
284
279
285
280
286
281
message_text = f"Вітаємо { message .from_user .mention } у нашому чаті! Ми не чат, а дружня, толерантна IT спільнота, яка поважає думку кожного, приєднавшись, ти згоджуєшся стати чемною частиною спільноти (та полюбити епл). I якшо не важко, пліз тут анкета на 8 питань https://forms.gle/pY6EjJhNRosUbd9P9"
287
- msg = await bot .send_animation (chat_id = message .chat .id , reply_to_message_id = message .message_id , animation = open ("media/welcome.mp4" , 'rb' ), caption = message_text , reply_markup = keyboard )
282
+ msg = await bot .send_animation (chat_id = message .chat .id , reply_to_message_id = message .message_id , animation = open ("data/ media/welcome.mp4" , 'rb' ), caption = message_text , reply_markup = keyboard )
288
283
await autodelete_message (msg .chat .id , msg .message_id , destruction_timeout * 5 )
289
284
290
285
@@ -355,21 +350,21 @@ async def zrada(message: types.Message):
355
350
@dp .message_handler (white_list_chats (), ignore_old_messages (), regexp = 'xiaomi|сяоми|ксиоми|ксяоми' )
356
351
@update_user
357
352
async def xiaomi (message : types .Message ):
358
- msg = await bot .send_photo (message .chat .id , reply_to_message_id = message .message_id , photo = open ('media/xiaomi.jpg' , 'rb' ))
353
+ msg = await bot .send_photo (message .chat .id , reply_to_message_id = message .message_id , photo = open ('data/ media/xiaomi.jpg' , 'rb' ))
359
354
await autodelete_message (msg .chat .id , msg .message_id , destruction_timeout )
360
355
361
356
362
357
@dp .message_handler (white_list_chats (), ignore_old_messages (), regexp = 'iphone|айфон|іфон|епл|еппл|apple|ipad|айпад|macbook|макбук' )
363
358
@update_user
364
359
async def iphone (message : types .Message ):
365
- msg = await bot .send_photo (message .chat .id , reply_to_message_id = message .message_id , photo = open ('media/iphon.jpg' , 'rb' ))
360
+ msg = await bot .send_photo (message .chat .id , reply_to_message_id = message .message_id , photo = open ('data/ media/iphon.jpg' , 'rb' ))
366
361
await autodelete_message (msg .chat .id , msg .message_id , destruction_timeout )
367
362
368
363
369
364
@dp .message_handler (white_list_chats (), ignore_old_messages (), regexp = 'шарий|шарій' )
370
365
@update_user
371
366
async def сockman (message : types .Message ):
372
- msg = await bot .send_video (message .chat .id , video = open ('media/sh.MOV' , mode = 'rb' ))
367
+ msg = await bot .send_video (message .chat .id , video = open ('data/ media/sh.MOV' , mode = 'rb' ))
373
368
await autodelete_message (msg .chat .id , msg .message_id , destruction_timeout )
374
369
375
370
0 commit comments