Skip to content

Commit

Permalink
v0.2.7-beta
Browse files Browse the repository at this point in the history
Merge pull request #21 from Hamziee/dev
  • Loading branch information
Hamziee authored Apr 23, 2024
2 parents 4d054bc + 7856745 commit eb30ec0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 20 deletions.
3 changes: 1 addition & 2 deletions Ava.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
try:
import config
except:
print(Fore.RED + Style.BRIGHT + "Config file could not be found, please refer to the setup instructions in the readme.md file!" + Fore.RESET)
exit()
raise ValueError(Fore.RED + Style.BRIGHT + "Config file could not be found, please refer to the setup instructions in the readme.md file!" + Fore.RESET)
import os

class Client(commands.Bot):
Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

The following versions will receive security updates as needed:

| Version | Supported |
| --------- | ------------------ |
| 0.2.6-b | :white_check_mark: |
| < 0.2.6-b | :x: |
| Version | Supported |
| ------------ | ------------------ |
| 0.2.7-beta | :white_check_mark: |
| < 0.2.7-beta | :x: |

## Reporting a Vulnerability

Expand Down
4 changes: 2 additions & 2 deletions commands/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ async def about(self, interaction: discord.Interaction):
embed = discord.Embed(
color=discord.Colour.blurple(),
title="Hi I'm Ava! <:Ava_CatBlush:1210004576082853939>",
description="I am an versatile and open-source Discord bot designed to serve all your needs effortlessly. With Ava by your side, managing your server becomes a breeze. From moderation tools to fun utilities, Ava has it all covered. Embrace simplicity and functionality with Ava, the reliable companion for any Discord community.\n### [Request Feature](https://github.com/Hamziee/Ava/issues/new) **|** [Github](https://github.com/Hamziee/Ava>) **|** [Maintainer](<https://github.com/Hamziee/>) **|** [Hosted by HEO Systems](<https://heo-systems.net>)\n\n**Developer Note:** Ava is currently a work in progress, and I am working on adding new and exciting features to Ava. Please bear in mind that this is a project of mine that I work on in my free time, so don't expect fast progress. - Hamza")
description="I am an versatile and open-source Discord bot designed to serve all your needs effortlessly. With Ava by your side, managing your server becomes a breeze. From moderation tools to fun utilities, Ava has it all covered. Embrace simplicity and functionality with Ava, the reliable companion for any Discord community.\n### [Request Feature](https://github.com/Hamziee/Ava/issues/new) **|** [Github](https://github.com/Hamziee/Ava>) **|** [Maintainer](<https://github.com/Hamziee/>) \n[Hosted by HEO Systems](<https://heo-systems.net>)\n\n**Developer Note:** Ava is currently a work in progress, and I am working on adding new and exciting features to Ava. Please bear in mind that this is a project of mine that I work on in my free time, so don't expect fast progress. - Hamza")
embed.set_footer(text=f"Ava | version: {config.AVA_VERSION}", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
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(about(client))
await client.add_cog(about(client))
24 changes: 17 additions & 7 deletions commands/cats.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
import discord
from discord.ext import commands
from discord import app_commands
from colorama import Back, Fore, Style
import httpx
from datetime import datetime
import config
global cats_enabled
if config.THECATAPI_KEY == 'your thecatapi key here':
print(Fore.RED + Style.BRIGHT + "Please provide your thecatapi key in config.py.\nThe cats command will not work without it.\nGet your own free key at https://thecatapi.com/\n\nIf you wish to hide this error, please put cats.py in the disabled_commands folder." + Fore.RESET)
cats_enabled = False
else:
cats_enabled = True

class cats(commands.Cog):
def __init__(self, client: commands.Bot):
self.client = client

@app_commands.command(name="cats", description="Get your daily dose of cats :)")
async def cats(self, interaction: discord.Interaction):
if cats_enabled == False:
print(Fore.RED + Style.BRIGHT + "[!] User tried to run cats command.\nPlease provide your thecatapi key in config.py.\nThe cats command will not work without it.\nGet your own free key at https://thecatapi.com/\n\nIf you wish to hide this error, please put cats.py in the disabled_commands folder." + Fore.RESET)
await interaction.response.send_message(content='The cats command is disabled due to missing thecatapi key. Please contact the bot owner.\n\nNote for bot owner: If you wish to hide this error, please put cats.py in the disabled_commands folder.')
return
try:
now = datetime.now()
timestamp = round(datetime.timestamp(now))
async with httpx.AsyncClient() as client:
response = await client.get(f"https://cataas.com/cat?timestamp={timestamp}")
image_url = response.url
response = await client.get("https://api.thecatapi.com/v1/images/search", headers={"x-api-key": config.THECATAPI_KEY})
data = response.json()
image_url = data[0]['url']

embed = discord.Embed(
color=discord.Colour.blurple(),
#title='Random Cat Image',
#description='Here is a random image of a cat:'
color=discord.Colour.blurple()
)
embed.set_image(url=image_url)
embed.set_footer(text=f"Ava | version: {config.AVA_VERSION} - Image by: thecatapi.com", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")

await interaction.response.send_message(embed=embed)
except Exception as e:
Expand Down
2 changes: 2 additions & 0 deletions commands/dogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from discord import app_commands
import httpx
from datetime import datetime
import config

class dogs(commands.Cog):
def __init__(self, client: commands.Bot):
Expand All @@ -20,6 +21,7 @@ async def dogs(self, interaction: discord.Interaction):
color=discord.Colour.blurple()
)
embed.set_image(url=image_url)
embed.set_footer(text=f"Ava | version: {config.AVA_VERSION} - Image by: dog.ceo/dog-api/", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")

await interaction.response.send_message(embed=embed)
except httpx.HTTPError as http_err:
Expand Down
16 changes: 11 additions & 5 deletions ex_config (change me to config.py).py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
AVA_VERSION='v0.2.6-b' # Do not change this, it will help with troubleshooting later
AVA_VERSION='v0.2.7-beta' # Do not change this, it will help with troubleshooting later

PREFIX = '$' # deprecated, only used for admin and music commands.
OWNER_ID = 496673945211240462 # used for admin commands and ChatAI recognition.
PERMISSION_DENIED = 'You do not have permission to run this command.' # this message will popup when a normal user runs a admin command.
STATUS = AVA_VERSION # Want a custom status? Replace it with: STATUS = 'your status here'.
# Required Bot Configuration

PREFIX = '$' # deprecated, only used for admin or music commands.
OWNER_ID = 496673945211240462 # used for admin commands and ChatAI recognition
PERMISSION_DENIED = 'You do not have permission to run this command.' # copied from my old bot, unused for now
STATUS = AVA_VERSION # Want a custom status? Replace it with: STATUS = 'your status here'
TOKEN = 'Put your Discord bot token here.'
COMMANDS_DIRECTORY = 'commands'

# Optional Bot Configuration

THECATAPI_KEY = 'your thecatapi key here' # Get your own free key at https://thecatapi.com/

0 comments on commit eb30ec0

Please sign in to comment.