Quackalicious
@Quackalicious
OKAY WHAT IS THE PROBLEM WITH MESSAGE.AUTHOR.ROLE PLEASE EXPLAIN
Python
AloeBest That's not how you fetch roles. @SilentSerenity is right. This is how you fetch roles:
array = [];
@bot.command(pass_context=True)
async def getuser(ctx, role: discord.Role):
role = discord.utils.get(ctx.message.server.roles, name="mod")
if role is None:
await bot.say('There is no "mod" role on this server!')
return
empty = True
for member in ctx.message.server.members:
if role in member.roles:
await bot.say("{0.name}: {0.id}".format(member))
2 years ago
I'm new to coding and I FINALLY MADE SOMETHING THAT CAN SAVE DATA INTO A FILE INSTEAD OF MEMORY THAT GETS LOST INTO THIN AIR. ┏(^0^)┛ Edit: now scroll
Python
I'm new here to repl.it and I have been coding in python for a bit. I'm trying to connect my python code with my google API and spreadsheets but I als
LuizEduardo69 Para quem quer algo menor tem esse:
credentials = json.loads(os.getenv("key"))
com carregar com dicionario1 year ago
Coder100 You can use first turn the json into one line, and then paste it into a key, like this:
#.env
KEY={"a":"...","b":"..."}
then when you access it, all you have to do is:
import json
import os
print(json.loads(os.getenv("KEY")))
`2 years ago
robowolf I've also tried to use google spreadsheets on repl. Sadly there is no way to conceal a JSON file. What you could do is find some components of the JSON file that you could put in a .env for later use. Another way to do it is obfuscation, which means you could encrypt it (https://qvault.io/2020/02/06/aes-256-cipher-python-cryptography-examples/) and store the encryption in a .env file. Then you can decrypt it when you need to use it. Any methods using a .env cannot be used by other people unless 2 years ago