Skip to content

Commit

Permalink
Version: 0.1.4-b
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamziee committed Feb 24, 2024
1 parent cac2cb2 commit e114e6f
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 18 deletions.
13 changes: 4 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
# Scripts which are not done yet:
commands/ChatAI.py

# Closed Source Code:
# AI funcionality is currently closed source, this is part of another project called Ava.
AvaAI
AvaAI.py
Ava
Ava.py
commands/AvaAI
commands/AvaAI.py
commands/Ava
commands/Ava.py
MiaAI
MiaAI.py
commands/MiaAI
commands/MiaAI.py

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
70 changes: 70 additions & 0 deletions commands/ChatAI.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

# IMPORTANT NOTE:
# MiaAI 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.

import discord
from discord.ext import commands
from discord import app_commands
import config
from MiaAI 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 Mia.')
async def chat(self, interaction: discord.Interaction, message: str):
try:
if interaction.user.id == config.OWNER_ID:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="MiaAI DEV 💬",
description="Mia is thinking... <:MIA_CuteThink:1211038099086512199>")
embed.set_footer(text=f"Mia | version: DEV {config.MIA_VERSION} | Keep in mind that Mia can make mistakes.", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
await interaction.response.send_message(embed=embed)
response = await ChatReponseHamza(message)
try:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="MiaAI DEV 💬",
description=response)
embed.set_footer(text=f"Mia | version: DEV {config.MIA_VERSION} | Keep in mind that Mia can make mistakes.", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
await interaction.edit_original_response(embed=embed)
except:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="MiaAI DEV <:MIA_Error:1211046596373123174>",
description="Mia's response overwhelmed Discord with its size. Could you please ask her to provide a shorter response?")
embed.set_footer(text=f"Mia | version: DEV {config.MIA_VERSION} | Keep in mind that Mia can make mistakes.", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
await interaction.edit_original_response(embed=embed)
else:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="MiaAI 💬",
description="Mia is thinking... <:MIA_CuteThink:1211038099086512199>")
embed.set_footer(text=f"Mia | version: {config.MIA_VERSION} | Keep in mind that Mia can make mistakes.", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
await interaction.response.send_message(embed=embed)
response = await ChatReponseHamza(message)
try:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="MiaAI 💬",
description=response)
embed.set_footer(text=f"Mia | version: {config.MIA_VERSION} | Keep in mind that Mia can make mistakes.", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
await interaction.edit_original_response(embed=embed)
except:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="MiaAI <:MIA_Error:1211046596373123174>",
description="Mia's response overwhelmed Discord with its size. Could you please ask her to provide a shorter response?")
embed.set_footer(text=f"Mia | version: {config.MIA_VERSION} | Keep in mind that Mia can make mistakes.", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
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))
2 changes: 1 addition & 1 deletion commands/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def about(self, interaction: discord.Interaction):
try:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="Hi I'm Mia! <:CatBlush:1210004576082853939>",
title="Hi I'm Mia! <:MIA_CatBlush:1210004576082853939>",
description="I am an versatile and open-source Discord bot designed to serve all your needs effortlessly. With Mia by your side, managing your server becomes a breeze. From moderation tools to fun utilities, Mia has it all covered. Embrace simplicity and functionality with Mia, the reliable companion for any Discord community.\n### [Request Feature](https://github.com/Hamziee/Mia/issues/new) **|** [Github](https://github.com/Hamziee/Mia>) **|** [Maintainer](<https://github.com/Hamziee/>) **|** [Hosted by HEO Systems](<https://heo-systems.net>)\n\n**Developer Note:** Mia is currently a work in progress, and I am working on adding new and exciting features to Mia. 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"Mia | version: {config.MIA_VERSION}", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
await interaction.response.send_message(embed=embed)
Expand Down
7 changes: 4 additions & 3 deletions commands/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async def help(self, interaction: discord.Interaction, category: str):
try:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="Hi I'm Mia! <:CatBlush:1210004576082853939>",
title="Hi I'm Mia! <:MIA_CatBlush:1210004576082853939>",
description="Here is some Information about my music commands :)")
embed.add_field(name='Music', value=
f"""**{prefix}join** - Joins a voice channel.
Expand All @@ -42,11 +42,12 @@ async def help(self, interaction: discord.Interaction, category: str):
try:
embed = discord.Embed(
color=discord.Colour.blurple(),
title="Hi I'm Mia! <:CatBlush:1210004576082853939>",
title="Hi I'm Mia! <:MIA_CatBlush:1210004576082853939>",
description="Here is some information about my commands :)")
embed.add_field(name='General', value=
f"""**/help** - Shows up this.
**/about** - Some information about me!""", inline=False)
**/about** - Some information about me!
**/chat** - Chat with my AI!""", inline=False)
embed.add_field(name='Music commands', value=
f""" Run **/help music** for information about all my music commands.""", inline=False)
embed.set_footer(text=f"Mia | version: {MIA_VERSION}", icon_url="https://cdn.discordapp.com/avatars/1209925239652356147/38e76bc9070eb00f2493b6edeab22b33.webp")
Expand Down
4 changes: 2 additions & 2 deletions commands/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ async def audio_player_task(self):
self.next.clear()

if not self.loop:
# Try to get the next song within 30 seconds.
# Try to get the next song within 3 minutes.
# If no song will be added to the queue in time,
# the player will disconnect due to performance
# reasons.
try:
async with timeout(30): # 30 seconds
async with timeout(180): # 3 minutes
self.current = await self.songs.get()
except asyncio.TimeoutError:
self.bot.loop.create_task(self.stop())
Expand Down
6 changes: 3 additions & 3 deletions ex_config (change me to config.py).py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MIA_VERSION='v0.1.3-b' # Do not change this, it will help with troubleshooting later
MIA_VERSION='v0.1.4-b' # Do not change this, it will help with troubleshooting later

PREFIX = '$' # deprecated only used for admin or music commands.
OWNER_ID = 496673945211240462 # copied from my old bot, unused for now
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 = MIA_VERSION # Want a custom status? Replace it with: STATUS = 'your status here'
TOKEN = 'Put your Discord bot token here.'
Expand Down

0 comments on commit e114e6f

Please sign in to comment.