mirror of
https://github.com/NovaOSS/nova-cord.git
synced 2024-11-25 22:33:58 +01:00
Compare commits
No commits in common. "e21ecaa6196f145434b5b1b64192363dc4b2cbc5" and "6bf0c7ab5bf45459e3feaa4d1151e537c5f4b02c" have entirely different histories.
e21ecaa619
...
6bf0c7ab5b
0
cord/__main__.py
Executable file → Normal file
0
cord/__main__.py
Executable file → Normal file
44
cord/accounts.py
Executable file → Normal file
44
cord/accounts.py
Executable file → Normal file
|
@ -3,8 +3,6 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
import string
|
|
||||||
import random
|
|
||||||
|
|
||||||
import embedder
|
import embedder
|
||||||
|
|
||||||
|
@ -124,45 +122,3 @@ Please report this issue to the staff!""", ephemeral=True)
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
await embedder.ok(interaction, f"""Successfully set the credits of {user.name} to **{amount}**.""", ephemeral=True)
|
await embedder.ok(interaction, f"""Successfully set the credits of {user.name} to **{amount}**.""", ephemeral=True)
|
||||||
|
|
||||||
async def reset_key(interaction):
|
|
||||||
|
|
||||||
return await embedder.error(interaction, """Not finished yet""", ephemeral=True)
|
|
||||||
|
|
||||||
try:
|
|
||||||
account = await get_account(interaction)
|
|
||||||
|
|
||||||
if not account:
|
|
||||||
await embedder.error(interaction, """It seems like you don't have an account yet.""", ephemeral=True)
|
|
||||||
|
|
||||||
requests.put(
|
|
||||||
url=f'http://localhost:2333/users',
|
|
||||||
timeout=3,
|
|
||||||
headers={
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': os.getenv('CORE_API_KEY')
|
|
||||||
},
|
|
||||||
data=json.dumps({
|
|
||||||
"discord_id": account["auth"]["discord"],
|
|
||||||
"updates": {"$set": {"api_key": await new_api_key()}}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
await embedder.ok(interaction, f"""Successfully reset your key!""", ephemeral=True)
|
|
||||||
|
|
||||||
except Exception as exc:
|
|
||||||
await embedder.error(interaction, """Sorry, there was an error while resetting your key.
|
|
||||||
Please report this issue to the staff!""", ephemeral=True)
|
|
||||||
raise exc
|
|
||||||
|
|
||||||
|
|
||||||
async def new_api_key() -> str:
|
|
||||||
chars = string.ascii_letters + string.digits
|
|
||||||
|
|
||||||
infix = os.getenv('KEYGEN_INFIX')
|
|
||||||
suffix = ''.join(random.choices(chars, k=20))
|
|
||||||
prefix = ''.join(random.choices(chars, k=20))
|
|
||||||
|
|
||||||
new_api_key = f'nv-{prefix}{infix}{suffix}'
|
|
||||||
|
|
||||||
return new_api_key
|
|
0
cord/api.py
Executable file → Normal file
0
cord/api.py
Executable file → Normal file
0
cord/autochat.py
Executable file → Normal file
0
cord/autochat.py
Executable file → Normal file
3
cord/bot.py
Executable file → Normal file
3
cord/bot.py
Executable file → Normal file
|
@ -124,9 +124,6 @@ async def music(interaction: nextcord.Interaction):
|
||||||
return await embedder.ok(interaction, text)
|
return await embedder.ok(interaction, text)
|
||||||
return await embedder.error(interaction, 'No one is listening to anything right now.')
|
return await embedder.error(interaction, 'No one is listening to anything right now.')
|
||||||
|
|
||||||
@bot.slash_command(description='Get yourself a new API key')
|
|
||||||
async def resetkey(interaction: nextcord.Interaction):
|
|
||||||
return await accounts.reset_key(interaction)
|
|
||||||
|
|
||||||
async def status_update():
|
async def status_update():
|
||||||
guild = bot.get_guild(int(os.getenv('DISCORD_GUILD')))
|
guild = bot.get_guild(int(os.getenv('DISCORD_GUILD')))
|
||||||
|
|
0
cord/chatbot.py
Executable file → Normal file
0
cord/chatbot.py
Executable file → Normal file
0
cord/community.py
Executable file → Normal file
0
cord/community.py
Executable file → Normal file
0
cord/credential_manager.py
Executable file → Normal file
0
cord/credential_manager.py
Executable file → Normal file
0
cord/embedder.py
Executable file → Normal file
0
cord/embedder.py
Executable file → Normal file
0
cord/tos_verification.py
Executable file → Normal file
0
cord/tos_verification.py
Executable file → Normal file
0
cord/tutorials.py
Executable file → Normal file
0
cord/tutorials.py
Executable file → Normal file
Loading…
Reference in a new issue