pasar de secrets a variables de entorno
This commit is contained in:
10
main.py
10
main.py
@@ -32,7 +32,7 @@ async def on_ready():
|
||||
|
||||
|
||||
async def send_log(msg): #Mandar log
|
||||
channel = bot.get_channel(secrets.IDcanalLogs) #Canal al que se envía el log
|
||||
channel = bot.get_channel(os.environ["IDcanalLogs"]) #Canal al que se envía el log
|
||||
await channel.send(msg)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ async def mandar_noticia():
|
||||
global ultimaurl
|
||||
|
||||
try:
|
||||
channel = bot.get_channel(secrets.IDcanalNoticias) #Canal al que se envía el mensaje
|
||||
channel = bot.get_channel(os.environ["IDcanalNoticias"]) #Canal al que se envía el mensaje
|
||||
|
||||
r = requests.get(url)
|
||||
xml = xmltodict.parse(r.text)
|
||||
@@ -54,7 +54,7 @@ async def mandar_noticia():
|
||||
nuevas.append(loc)
|
||||
|
||||
if nuevas: #Si el array no está vacío
|
||||
await channel.send(f"Atención <@&{secrets.IDrol}> hay nuevas noticias:") #Luego hay que cambiar el rol
|
||||
await channel.send(f"Atención <@&{os.environ['IDRol']}> hay nuevas noticias:") #Luego hay que cambiar el rol
|
||||
for loc in reversed(nuevas): #Recorre el array hacia atrás para mandarlas en orden.
|
||||
await channel.send(f"\n{loc}")
|
||||
ultimaurl = urls[0] #Actualizamos la url vieja
|
||||
@@ -64,7 +64,7 @@ async def mandar_noticia():
|
||||
|
||||
@bot.command()
|
||||
async def noticias(ctx):
|
||||
rol = ctx.guild.get_role(secrets.IDrol)
|
||||
rol = ctx.guild.get_role(os.environ["IDRol"])
|
||||
user = ctx.author
|
||||
|
||||
if rol in user.roles:
|
||||
@@ -97,4 +97,4 @@ async def noticias(ctx):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
bot.run(secrets.TOKEN)
|
||||
bot.run(os.environ["TOKEN"])
|
||||
Reference in New Issue
Block a user