pavan
@chinnupavan48
i want to load an integer value from a json file using user.id
how can i pass this in
Coder100 I recommend using replit db instead for this job as json files do reset. It may not be today, but it will happen!
Anyways, here is the db version:
from replit import db
def someFunctionToAddCooldown(id, amt):
db[id] = amt
def getCooldownFromUser(id):
return db[id]
`2 years ago
VulcanWM import json
with open('example.json', 'r') as myfile:
data=myfile.read()
obj = json.loads(data)
cooldown = obj.get(userid, None)
if the userid has a cooldown, it will be the variable, if not, it will be equal to None
This is the code to get the cooldown value from the json file2 years ago
how to know that how much of RAM,ROM,CPU is in use for this script ?
MocaCDeveloper Hi!
I believe there is the package psutil available.
You will have to install it via pip(or pip3, depending). It's a simple installation:
pip3 install psutil.
Then, within your Python code(wherever you need it), just simply import it! There is some great documentation over this, but the most basic use is:
import psutil
print(psutil.cpu_percent(4))
I will briefly go over the above program:
psutil.cpupercent gets the system-wide CPU utilization as a percentage. The arguments are interval = No2 years ago
I tried this ..
async def oncommanderror(ctx,error):
if isinstance(error,commands.CommandOnCooldown):
s=error.retry_after
mes=('Tr
MrVoo Make your own function for it, like this.
from time import sleep
def sleep2(h,m,s):
duration = s+ m60+ h3600
sleep(duration)
`2 years ago
i am new to discord.py but i know python and i have started creating meme bot but i dont know how to send a post from a instagram page..please help me
CosmicBear You could use an api maybe https://developers.facebook.com/docs/instagram-basic-display-api. If that doesn't work try web-scraping using beautifulsoup. Also if telugumemes123 is your account, i may have logged into it. Use the .env system to keep that kind of data hidden.2 years ago
codingjlu If Instagram doesn't have an API for this, web scraping is the way to go. I'm not sure exactly how Instagram works but you'll most likely have to use Selenium of Pyppeteer (or Puppeteer for Node.js, a much better option).2 years ago