-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Hamziee/dev
v0.7.0-beta
- Loading branch information
Showing
14 changed files
with
247 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import discord | ||
from discord.ext import commands | ||
from discord import app_commands | ||
import config | ||
import sys | ||
import pkg_resources | ||
import requests | ||
|
||
class info(commands.Cog): | ||
def __init__(self, client: commands.Bot): | ||
self.client = client | ||
|
||
@app_commands.command(name="technical_information", description="Display technical information") | ||
async def info(self, interaction: discord.Interaction): | ||
try: | ||
# Version Checker | ||
# Get the content from the URL | ||
url = "https://cdn.hamzie.site/Ava/VRC/core.txt" | ||
response = requests.get(url) | ||
|
||
# Check if the content matches the AVA_VERSION | ||
if response.status_code == 200: # Make sure the request was successful | ||
remote_version = response.text.strip() | ||
else: | ||
remote_version = "Failed to fetch." | ||
|
||
# TheCatAPI Check | ||
if config.THECATAPI_KEY == 'your thecatapi key here': | ||
cats_string = 'Disabled' | ||
else: | ||
cats_string = 'Enabled' | ||
|
||
# Python Version | ||
python_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" | ||
|
||
# Get installed packages and format them | ||
installed_packages = pkg_resources.working_set | ||
package_list = "\n".join([f"{package.project_name} {package.version}" for package in installed_packages]) | ||
|
||
embed = discord.Embed( | ||
color=discord.Colour.blurple(), | ||
title="Technical Details", | ||
description="If you are looking for information about the bot, run the command: '/about'") | ||
embed.add_field(name='Core', value=f'Running Ava {config.AVA_VERSION} | (Latest: {remote_version})\nAva Config Version: {config.CONFIG_VERSION}\nPython {python_version}', inline=False) | ||
embed.add_field(name="Python Packages", value=package_list, inline=False) | ||
embed.add_field(name="Ava Optional Modules", value=f'AvaAI: Disabled - In Development | (Being Rewritten)\nTheCatAPI: {cats_string} | (Will be removed in favor of a new system that will be provided by Hamzie API)', inline=False) | ||
embed.set_footer(text=f"Ava | version: {config.AVA_VERSION}", icon_url=config.FOOTER_ICON) | ||
await interaction.response.send_message(embed=embed) | ||
except Exception as e: | ||
print(e) | ||
await interaction.followup.send(content='Error occured.') | ||
|
||
async def setup(client:commands.Bot) -> None: | ||
await client.add_cog(info(client)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
# IMPORTANT NOTE: | ||
# AvaAI is closed source for now. ChatAI will NOT work for you unless you make your function for this command to process! If you do not know what that means then don't bother getting this to work, I might add an example script to use OpenAI in the future. | ||
# This script calls for ChatReponse() to respond with a message. | ||
|
||
|
||
# This is in progress of begin rewritten | ||
|
||
import discord | ||
from discord.ext import commands | ||
from discord import app_commands | ||
import config | ||
from extraConfigs.ChatAIConfig import * | ||
|
||
class chat(commands.Cog): | ||
def __init__(self, client: commands.Bot): | ||
self.client = client | ||
|
||
@app_commands.command(name="chat", description="Chat with me!") | ||
@app_commands.rename(message='message') | ||
@app_commands.describe(message='Type the message you wish to send to Ava.') | ||
async def chat(self, interaction: discord.Interaction, message: str): | ||
try: | ||
embed = discord.Embed( | ||
color=discord.Colour.blurple(), | ||
title="AvaAI 💬", | ||
description="Ava is thinking... <:AVA_CuteThink:1211038099086512199>") | ||
embed.set_footer(text=f"Ava | version: {config.AVA_VERSION} | Keep in mind that Ava can make mistakes.", icon_url=config.FOOTER_ICON) | ||
await interaction.response.send_message(embed=embed) | ||
response = await ChatReponse(message) | ||
try: | ||
embed = discord.Embed( | ||
color=discord.Colour.blurple(), | ||
title="AvaAI 💬", | ||
description=response) | ||
embed.set_footer(text=f"Ava | version: {config.AVA_VERSION} | Keep in mind that Ava can make mistakes.", icon_url=config.FOOTER_ICON) | ||
await interaction.edit_original_response(embed=embed) | ||
except: | ||
embed = discord.Embed( | ||
color=discord.Colour.blurple(), | ||
title="AvaAI <:Ava_Error:1211046596373123174>", | ||
description="Ava's response overwhelmed Discord with its size. Could you please ask her to provide a shorter response?") | ||
embed.set_footer(text=f"Ava | version: {config.AVA_VERSION} | Keep in mind that Ava can make mistakes.", icon_url=config.FOOTER_ICON) | ||
await interaction.edit_original_response(embed=embed) | ||
except Exception as e: | ||
print(e) | ||
await interaction.followup.send(content='Error occured.') | ||
|
||
async def setup(client:commands.Bot) -> None: | ||
await client.add_cog(chat(client)) |
Oops, something went wrong.