Added more tutorials

This commit is contained in:
nsde 2023-08-03 20:40:54 +02:00
parent 70f395c0a7
commit 738352a063
3 changed files with 67 additions and 2 deletions

View file

@ -76,7 +76,18 @@ async def tutorial(interaction: nextcord.Interaction,
how_can_i: str = SlashOption(# how_can_i: str = SlashOption(#
description='Read a tutorial on how to...', description='Read a tutorial on how to...',
required=True, required=True,
choices=['fix ModuleNotFoundErrors', 'use the Python library', 'use curl', 'use Node.js', 'program a Python Discord Bot with streaming'] choices=[
'fix error 401 (invalid key)',
'fix error 429 (ratelimit/not enough credits)',
'use GPT-4',
'use curl',
'use Node.js',
'get my NovaAI API key',
'use the Python library',
'fix ModuleNotFoundErrors',
'use the API in custom front-ends',
'program a Python Discord Bot with streaming',
]
) )
): ):
return await tutorials.send(interaction, how_can_i) return await tutorials.send(interaction, how_can_i)

View file

@ -67,6 +67,7 @@ We reserve the right to __disable your API key at any time__ if you violate our
If you accept the terms of service and privacy policy, feel free to use the following API key: If you accept the terms of service and privacy policy, feel free to use the following API key:
## ||`{api_key}`|| ## ||`{api_key}`||
(Don't see anything? Click the empty space above to reveal it.)
Learn more about how to use our API at **https://nova-oss.com**. Learn more about how to use our API at **https://nova-oss.com**.
""", ephemeral=True) """, ephemeral=True)

View file

@ -1,6 +1,59 @@
import embedder import embedder
async def send(interaction, how_can_i): async def send(interaction, how_can_i):
if how_can_i == 'fix error 429 (ratelimit/not enough credits)':
text = """This means you used the API too often. You can either wait or:
- boost the server
- donate cryptocurrency (and contact us before or after so we can verify it was you)
- contribute in any meaningful (we decide) way (programming, research, design, moderating the Discord etc.)
If you try to bypass this, all your accounts and IP addresses may get banned.
"""
if how_can_i == 'fix error 401 (invalid key)':
text = """Make sure you entered your NovaAI API key (starting with `nv-`) correctly.
For HTTP requests, it can be specified using a header:
```
Authorization: Bearer nv-...
```
"""
if how_can_i == 'use GPT-4':
text = """Yes, we support GPT-4. For free. You read that correctly.
Please note though that it might not be very stable or support every parameter.
Simply set the model to `gpt-4`. That's it <3
"""
if how_can_i == 'use the API in custom front-ends':
text = """Depending on the front end, the endpoints might differ a bit:
**ChatGPT Next Web**
(https://chat-gpt-next-web.vercel.app/):
`https://api.nova-oss.com`
Code: https://github.com/Yidadaa/ChatGPT-Next-Web
**Better ChatGPT**
(https://chat.resisto.rodeo/, https://chatgpt1.nextweb.fun/, https://freechatgpt.chat/, https://bettergpt.chat/):
`https://api.nova-oss.com/v1/chat/completions`
Code: https://github.com/ztjhz/BetterChatGPT
Don't forget to also set the correct model and API key!
**Warning:** in theory, these front-ends could __steal your NovaAI key__.
Self-host them if you know how to. Otherwise, wait for us to create a official NovaAI front-end.
"""
if how_can_i == 'get my NovaAI API key':
text = """Open up the **`#commands`** channel and run **`/credentials`**.
Then, follow the instructions carefully.
Fore more information: https://nova-oss.com/novacord
"""
if how_can_i == 'fix ModuleNotFoundErrors': if how_can_i == 'fix ModuleNotFoundErrors':
text = """You can install Python packages using `pip`. Here's an example: `pip install openai`. text = """You can install Python packages using `pip`. Here's an example: `pip install openai`.
Don't have `pip` installed? Learn more here: https://pip.pypa.io/en/stable/installation/. Don't have `pip` installed? Learn more here: https://pip.pypa.io/en/stable/installation/.
@ -127,4 +180,4 @@ async def chat(interaction: nextcord.Interaction,
bot.run(os.getenv('DISCORD_TOKEN')) bot.run(os.getenv('DISCORD_TOKEN'))
``` ```
""" """
return await embedder.info(interaction, text) return await embedder.info(interaction, title=f'Tutorial: "{how_can_i}"', text=text)