randydev commited on
Commit
1592eec
1 Parent(s): fa1b040

Update chatbot/__init__.py

Browse files
Files changed (1) hide show
  1. chatbot/__init__.py +8 -5
chatbot/__init__.py CHANGED
@@ -5,6 +5,7 @@ import pyrogram
5
  import string
6
  import random
7
  import requests
 
8
  from inspect import getfullargspec
9
  from os import path
10
  from random import choice
@@ -28,15 +29,17 @@ from pyrogram import __version__ as pyrogram_version
28
  StartTime = time.time()
29
  START_TIME = dt.now()
30
 
31
- def send_log(text_log: str):
32
  url = "https://private-akeno.randydev.my.id/api/v2/send_message_logs"
33
  params = {
34
  "text_log": text_log
35
  }
36
- response = requests.post(url, params=params)
37
- if response.status_code != 200:
38
- return None
39
- return response.json()["message"]
 
 
40
 
41
  class Randydev(Client):
42
  def __init__(self, loop=None):
 
5
  import string
6
  import random
7
  import requests
8
+ import aiohttp
9
  from inspect import getfullargspec
10
  from os import path
11
  from random import choice
 
29
  StartTime = time.time()
30
  START_TIME = dt.now()
31
 
32
+ async def send_log(text_log: str):
33
  url = "https://private-akeno.randydev.my.id/api/v2/send_message_logs"
34
  params = {
35
  "text_log": text_log
36
  }
37
+ async with aiohttp.ClientSession() as session:
38
+ async with session.post(url, params=params) as response:
39
+ if response.status != 200:
40
+ return None
41
+ data = await response.json()
42
+ return data["message"]
43
 
44
  class Randydev(Client):
45
  def __init__(self, loop=None):