From 7f5316482a75883090b8904ebfda901478eb3479 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:03:34 +0100 Subject: [PATCH 01/27] Update config.py --- code/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/config.py b/code/config.py index e4ebc9b..f9dff24 100644 --- a/code/config.py +++ b/code/config.py @@ -9,6 +9,9 @@ def debug(message): #create a database called "database.db" if the database does not exist, else connect to it conn = sqlite3.connect('../database/data.db') c = conn.cursor() +connp = sqlite3.connect('../database/premium.db') +cp = conn.cursor() # Create table called "data" if it does not exist with the following columns: guild_id, channel_id, api_key, is_active, max_tokens, temperature, frequency_penalty, presence_penalty, uses_count_today, prompt_size -c.execute('''CREATE TABLE IF NOT EXISTS data (guild_id text, channel_id text, api_key text, is_active boolean, max_tokens integer, temperature real, frequency_penalty real, presence_penalty real, uses_count_today integer, prompt_size integer, prompt_prefix text, tts boolean, pretend_to_be text, pretend_enabled boolean)''') \ No newline at end of file +c.execute('''CREATE TABLE IF NOT EXISTS data (guild_id text, channel_id text, api_key text, is_active boolean, max_tokens integer, temperature real, frequency_penalty real, presence_penalty real, uses_count_today integer, prompt_size integer, prompt_prefix text, tts boolean, pretend_to_be text, pretend_enabled boolean)''') +cp.execute('''CREATE TABLE IF NOT EXISTS data (user_id text, guild_id text, premium boolean)''') \ No newline at end of file From bd1373fef13331a6e20c8917f1245859c9ccbb34 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:09:51 +0100 Subject: [PATCH 02/27] Update chat.py --- code/cogs/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index cd63df4..53f5cdc 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -125,7 +125,7 @@ class Chat (discord.Cog) : prompt += "Botator:" prompt = prompt + f"\n" debug("Sending request to the api") - debug(prompt) + #debug(prompt) openai.api_key = api_key response = openai.Completion.create( engine="text-davinci-003", @@ -162,6 +162,7 @@ class Chat (discord.Cog) : if not premium: #get a random number between 1 and 5 , 1 and 4 # 5 included + debug("User is not premium, sending a random message") random_number = random.randint(1, 10) if random_number == 1: embed = discord.Embed(title="Support us by donating here!", url="https://www.buymeacoffee.com/paillat", description="Botator is a free discord bot, but it costs money to run our servers. If you want to support us, you can donate here: https://www.buymeacoffee.com/paillat. For only **2$** a month, you can remove this message and have a daliy maximal usage of **4000** uses instead of **400**. You will acces also to restricted help channels on our discord server,", color=0x00ff00) From a190f756c5cb39522b6d715c4f53dcfccc8dc511 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:15:31 +0100 Subject: [PATCH 03/27] Update premiumcode.py --- code/premiumcode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/code/premiumcode.py b/code/premiumcode.py index 07fd2bd..38d6114 100644 --- a/code/premiumcode.py +++ b/code/premiumcode.py @@ -7,6 +7,7 @@ intents = discord.Intents.all() conn = sqlite3.connect('premium.db') c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS data (user_id text, guild_id text, premium boolean)''') +c.commit() bot = discord.Bot() logging.basicConfig(level=logging.INFO) @bot.command() From 8ff9e5895365af8a3605dc4cacee087fc5fbfadf Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:17:53 +0100 Subject: [PATCH 04/27] Update premiumcode.py --- code/premiumcode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/premiumcode.py b/code/premiumcode.py index 38d6114..5fe5db9 100644 --- a/code/premiumcode.py +++ b/code/premiumcode.py @@ -7,7 +7,7 @@ intents = discord.Intents.all() conn = sqlite3.connect('premium.db') c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS data (user_id text, guild_id text, premium boolean)''') -c.commit() +conn.commit() bot = discord.Bot() logging.basicConfig(level=logging.INFO) @bot.command() From dde42bb4dc87d49b8bcb5378a6e6034d769849b6 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:19:50 +0100 Subject: [PATCH 05/27] Update premiumcode.py --- code/premiumcode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/premiumcode.py b/code/premiumcode.py index 5fe5db9..e6e22c1 100644 --- a/code/premiumcode.py +++ b/code/premiumcode.py @@ -4,7 +4,7 @@ import sqlite3 # pip install sqlite3 import logging # pip install logging import os # pip install os intents = discord.Intents.all() -conn = sqlite3.connect('premium.db') +conn = sqlite3.connect('../database/premium.db') c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS data (user_id text, guild_id text, premium boolean)''') conn.commit() From 4b9603e651fafce83897c12b630a511a58e54748 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:25:45 +0100 Subject: [PATCH 06/27] Update chat.py --- code/cogs/chat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index 53f5cdc..ed16a21 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -170,6 +170,8 @@ class Chat (discord.Cog) : elif random_number == 2: embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) + cp.execute("SELECT premium FROM data WHERE guild_id = ?", (message.guild.id,)) + debug(c.fetchone()[0]) @discord.slash_command(name="say", description="Say a message") async def say(self, ctx: discord.ApplicationContext, message: str): debug(f"The user {ctx.author.display_name} ran the say command command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") From 734121bd5d693c26b7637b0a89161042944fecbd Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:27:14 +0100 Subject: [PATCH 07/27] Update config.py --- code/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/config.py b/code/config.py index f9dff24..0b29c45 100644 --- a/code/config.py +++ b/code/config.py @@ -10,7 +10,7 @@ def debug(message): conn = sqlite3.connect('../database/data.db') c = conn.cursor() connp = sqlite3.connect('../database/premium.db') -cp = conn.cursor() +cp = connp.cursor() # Create table called "data" if it does not exist with the following columns: guild_id, channel_id, api_key, is_active, max_tokens, temperature, frequency_penalty, presence_penalty, uses_count_today, prompt_size c.execute('''CREATE TABLE IF NOT EXISTS data (guild_id text, channel_id text, api_key text, is_active boolean, max_tokens integer, temperature real, frequency_penalty real, presence_penalty real, uses_count_today integer, prompt_size integer, prompt_prefix text, tts boolean, pretend_to_be text, pretend_enabled boolean)''') From 9fd9a07e932cd529c6993fc2b80a1d4e4ca6d8d8 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:29:37 +0100 Subject: [PATCH 08/27] Update chat.py --- code/cogs/chat.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index ed16a21..b13bfaa 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -163,15 +163,13 @@ class Chat (discord.Cog) : #get a random number between 1 and 5 , 1 and 4 # 5 included debug("User is not premium, sending a random message") - random_number = random.randint(1, 10) - if random_number == 1: + random_number = random.randint(1, 20) + if random_number == 3: embed = discord.Embed(title="Support us by donating here!", url="https://www.buymeacoffee.com/paillat", description="Botator is a free discord bot, but it costs money to run our servers. If you want to support us, you can donate here: https://www.buymeacoffee.com/paillat. For only **2$** a month, you can remove this message and have a daliy maximal usage of **4000** uses instead of **400**. You will acces also to restricted help channels on our discord server,", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) - elif random_number == 2: + elif random_number == 11: embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) - cp.execute("SELECT premium FROM data WHERE guild_id = ?", (message.guild.id,)) - debug(c.fetchone()[0]) @discord.slash_command(name="say", description="Say a message") async def say(self, ctx: discord.ApplicationContext, message: str): debug(f"The user {ctx.author.display_name} ran the say command command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") From 0030c16d37191ae7d10dfa19a7ff0987f255dc6c Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:32:46 +0100 Subject: [PATCH 09/27] Update chat.py --- code/cogs/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index b13bfaa..dcbdb1c 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -40,7 +40,7 @@ class Chat (discord.Cog) : #check if the bot hasn't been used more than 5000 times in the last 24 hours (uses_count_today) c.execute("SELECT uses_count_today FROM data WHERE guild_id = ?", (message.guild.id,)) if c.fetchone()[0] >= max_uses: - debug("The bot has been used more than 4000 times in the last 24 hours in this guild") + debug(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") await message.channel.send("The bot has been used more than 5000 times in the last 24 hours in this guild. Please try again in 24h.") return #add 1 to the uses_count_today From c14d8f988612aeec598e168bdf312fe0bbb3acea Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:32:50 +0100 Subject: [PATCH 10/27] Update config.py --- code/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/config.py b/code/config.py index 0b29c45..4a4189e 100644 --- a/code/config.py +++ b/code/config.py @@ -1,6 +1,6 @@ import logging import sqlite3 -max_uses: int = 500 +max_uses: int = 400 logging.basicConfig(level=logging.INFO) def debug(message): From 5d94f31731b685b6fd115f80bd7a15b0d32e1584 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:35:41 +0100 Subject: [PATCH 11/27] Update chat.py --- code/cogs/chat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index dcbdb1c..78ca9a2 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -167,9 +167,11 @@ class Chat (discord.Cog) : if random_number == 3: embed = discord.Embed(title="Support us by donating here!", url="https://www.buymeacoffee.com/paillat", description="Botator is a free discord bot, but it costs money to run our servers. If you want to support us, you can donate here: https://www.buymeacoffee.com/paillat. For only **2$** a month, you can remove this message and have a daliy maximal usage of **4000** uses instead of **400**. You will acces also to restricted help channels on our discord server,", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) + debug("The \"support us\" message has been sent") elif random_number == 11: embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) + debug("The \"join our discord server\" message has been sent") @discord.slash_command(name="say", description="Say a message") async def say(self, ctx: discord.ApplicationContext, message: str): debug(f"The user {ctx.author.display_name} ran the say command command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") From 8b6f8d1a2d009682e62173ef8effe15409d0676c Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:46:23 +0100 Subject: [PATCH 12/27] Update chat.py --- code/cogs/chat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index 78ca9a2..0e7d714 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -168,9 +168,10 @@ class Chat (discord.Cog) : embed = discord.Embed(title="Support us by donating here!", url="https://www.buymeacoffee.com/paillat", description="Botator is a free discord bot, but it costs money to run our servers. If you want to support us, you can donate here: https://www.buymeacoffee.com/paillat. For only **2$** a month, you can remove this message and have a daliy maximal usage of **4000** uses instead of **400**. You will acces also to restricted help channels on our discord server,", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) debug("The \"support us\" message has been sent") - elif random_number == 11: - embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) - await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) + elif random_number == 11 or message.guild.id == 800029200886923315: + #add the picture https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png + embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00, image="https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png") + await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) debug("The \"join our discord server\" message has been sent") @discord.slash_command(name="say", description="Say a message") async def say(self, ctx: discord.ApplicationContext, message: str): From b11a421f15e1ce4f532e4e6a873bbd082ea84b86 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:49:23 +0100 Subject: [PATCH 13/27] Update chat.py --- code/cogs/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index 0e7d714..adfc967 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -39,9 +39,10 @@ class Chat (discord.Cog) : return #check if the bot hasn't been used more than 5000 times in the last 24 hours (uses_count_today) c.execute("SELECT uses_count_today FROM data WHERE guild_id = ?", (message.guild.id,)) + debug(f"uses_count_today: {c.fetchone()[0]}") if c.fetchone()[0] >= max_uses: debug(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") - await message.channel.send("The bot has been used more than 5000 times in the last 24 hours in this guild. Please try again in 24h.") + await message.channel.send(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") return #add 1 to the uses_count_today #show that the bot is typing From 9921f002d4f09b5b1bd40094c15edeac4d0bb767 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 01:52:17 +0100 Subject: [PATCH 14/27] Update chat.py --- code/cogs/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index adfc967..1240084 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -40,7 +40,7 @@ class Chat (discord.Cog) : #check if the bot hasn't been used more than 5000 times in the last 24 hours (uses_count_today) c.execute("SELECT uses_count_today FROM data WHERE guild_id = ?", (message.guild.id,)) debug(f"uses_count_today: {c.fetchone()[0]}") - if c.fetchone()[0] >= max_uses: + if int(c.fetchone()[0]) >= max_uses: debug(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") await message.channel.send(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") return From 40338441a08c047995246a3eda03a9d08575fa5c Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 02:00:52 +0100 Subject: [PATCH 15/27] Update chat.py --- code/cogs/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index 1240084..c1296a7 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -40,7 +40,8 @@ class Chat (discord.Cog) : #check if the bot hasn't been used more than 5000 times in the last 24 hours (uses_count_today) c.execute("SELECT uses_count_today FROM data WHERE guild_id = ?", (message.guild.id,)) debug(f"uses_count_today: {c.fetchone()[0]}") - if int(c.fetchone()[0]) >= max_uses: + actual_uses = c.fetchone()[0] + if actual_uses >= max_uses: debug(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") await message.channel.send(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") return From 07b952de68a61b5c08ea2d1af2b72c70be3d5ef2 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 02:03:42 +0100 Subject: [PATCH 16/27] Update chat.py --- code/cogs/chat.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index c1296a7..e16c4b9 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -39,11 +39,9 @@ class Chat (discord.Cog) : return #check if the bot hasn't been used more than 5000 times in the last 24 hours (uses_count_today) c.execute("SELECT uses_count_today FROM data WHERE guild_id = ?", (message.guild.id,)) - debug(f"uses_count_today: {c.fetchone()[0]}") - actual_uses = c.fetchone()[0] - if actual_uses >= max_uses: + if c.fetchone()[0] >= 500: debug(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") - await message.channel.send(f"The bot has been used more than {max_uses} times in the last 24 hours in this guild. Please try again in 24h.") + await message.channel.send("The bot has been used more than 5000 times in the last 24 hours in this guild. Please try again in 24h.") return #add 1 to the uses_count_today #show that the bot is typing From 2b5fd4e2c422fbac50eec6f024bf988c05657b17 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 02:10:39 +0100 Subject: [PATCH 17/27] Update chat.py --- code/cogs/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index e16c4b9..56e7f7c 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -170,7 +170,8 @@ class Chat (discord.Cog) : debug("The \"support us\" message has been sent") elif random_number == 11 or message.guild.id == 800029200886923315: #add the picture https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png - embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00, image="https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png") + embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) + embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png") await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) debug("The \"join our discord server\" message has been sent") @discord.slash_command(name="say", description="Say a message") From 72c7c960e023d1cd0d1019a850e929ce2b03689c Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 02:12:41 +0100 Subject: [PATCH 18/27] Update chat.py --- code/cogs/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index 56e7f7c..cc41c7d 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -172,7 +172,7 @@ class Chat (discord.Cog) : #add the picture https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png") - await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) + await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.** \nhttps://discord.gg/pB6hXtUeDv", embed=embed, delete_after=60) debug("The \"join our discord server\" message has been sent") @discord.slash_command(name="say", description="Say a message") async def say(self, ctx: discord.ApplicationContext, message: str): From 5ae8044a53d8ab5a483178b1f01cd929db42fb69 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 02:14:37 +0100 Subject: [PATCH 19/27] Update chat.py --- code/cogs/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index cc41c7d..19c88c5 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -168,7 +168,7 @@ class Chat (discord.Cog) : embed = discord.Embed(title="Support us by donating here!", url="https://www.buymeacoffee.com/paillat", description="Botator is a free discord bot, but it costs money to run our servers. If you want to support us, you can donate here: https://www.buymeacoffee.com/paillat. For only **2$** a month, you can remove this message and have a daliy maximal usage of **4000** uses instead of **400**. You will acces also to restricted help channels on our discord server,", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) debug("The \"support us\" message has been sent") - elif random_number == 11 or message.guild.id == 800029200886923315: + elif random_number == 11 or random_number == 12: #add the picture https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png") From 4ed74758ce46b1c736cba143b9eb5b7063b6b450 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 09:36:06 +0100 Subject: [PATCH 20/27] Update chat.py --- code/cogs/chat.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/cogs/chat.py b/code/cogs/chat.py index 19c88c5..1fa896b 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -164,18 +164,18 @@ class Chat (discord.Cog) : # 5 included debug("User is not premium, sending a random message") random_number = random.randint(1, 20) - if random_number == 3: + if random_number == 30: embed = discord.Embed(title="Support us by donating here!", url="https://www.buymeacoffee.com/paillat", description="Botator is a free discord bot, but it costs money to run our servers. If you want to support us, you can donate here: https://www.buymeacoffee.com/paillat. For only **2$** a month, you can remove this message and have a daliy maximal usage of **4000** uses instead of **400**. You will acces also to restricted help channels on our discord server,", color=0x00ff00) await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.**", embed=embed, delete_after=60) debug("The \"support us\" message has been sent") - elif random_number == 11 or random_number == 12: + elif random_number == 11: #add the picture https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png embed = discord.Embed(title="Join our discord server!", url="https://discord.gg/pB6hXtUeDv", description="You need help with Botator? You can join our discord server and ask for help in the help channel. You can also suggest new features and report bugs. You can also join our discord server to talk with other Botator users and the Botator team, by on the following link: https://discord.gg/pB6hXtUeDv", color=0x00ff00) embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/800029200886923318/1050935509930754058/icons8-discord-new-480.png") - await message.channel.send("**This message has 10% chance to appear. It will disappear in 60 seconds.** \nhttps://discord.gg/pB6hXtUeDv", embed=embed, delete_after=60) + await message.channel.send("**This message has 5% chance to appear. It will disappear in 60 seconds.** \nhttps://discord.gg/pB6hXtUeDv", embed=embed, delete_after=60) debug("The \"join our discord server\" message has been sent") @discord.slash_command(name="say", description="Say a message") async def say(self, ctx: discord.ApplicationContext, message: str): debug(f"The user {ctx.author.display_name} ran the say command command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") await ctx.respond("Message sent !", ephemeral=True) - await ctx.send(message) \ No newline at end of file + await ctx.send(message) From a496fa1889b00663530dc6b3834c3a29870cf5b3 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 17:51:36 +0100 Subject: [PATCH 21/27] Added leave pretend to be blank to disable --- code/cogs/settings.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/code/cogs/settings.py b/code/cogs/settings.py index 3ca4d7f..d96b342 100644 --- a/code/cogs/settings.py +++ b/code/cogs/settings.py @@ -127,7 +127,7 @@ class Settings (discord.Cog) : #when someone mentions the bot, check if the guild is in the database and if the bot is enabled. If it is, send a message answering the mention @discord.slash_command(name="pretend", description="Make the bot pretend to be someone else") - @discord.option(name="pretend to be...", description="The person/thing you want the bot to pretend to be", required=True) + @discord.option(name="pretend to be...", description="The person/thing you want the bot to pretend to be. Leave blank to disable pretend mode", required=False) async def pretend(self, ctx: discord.ApplicationContext, pretend_to_be: str): debug(f"The user {ctx.author} ran the pretend command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") #check if the guild is in the database @@ -140,23 +140,22 @@ class Settings (discord.Cog) : if c.fetchone()[3] == 0: await ctx.respond("The bot is disabled", ephemeral=True) return - #enable pretend if it is not enabled, and disable it if it is - c.execute("SELECT pretend_enabled FROM data WHERE guild_id = ?", (ctx.guild.id,)) - if c.fetchone()[0] == 1: + if pretend_to_be is None: + pretend_to_be = "" c.execute("UPDATE data SET pretend_enabled = 0 WHERE guild_id = ?", (ctx.guild.id,)) conn.commit() await ctx.respond("Pretend mode disabled", ephemeral=True) - botuser = await self.bot.fetch_user(self.bot.user.id) await ctx.guild.me.edit(nick=None) + return else: c.execute("UPDATE data SET pretend_enabled = 1 WHERE guild_id = ?", (ctx.guild.id,)) conn.commit() await ctx.respond("Pretend mode enabled", ephemeral=True) #change the bots name on the server wit ctx.guild.me.edit(nick=pretend_to_be) - await ctx.guild.me.edit(nick=pretend_to_be) - #save the pretend_to_be value - c.execute("UPDATE data SET pretend_to_be = ? WHERE guild_id = ?", (pretend_to_be, ctx.guild.id)) - conn.commit() + ctx.guild.me.edit(nick=pretend_to_be) + c.execute("UPDATE data SET pretend_to_be = ? WHERE guild_id = ?", (pretend_to_be, ctx.guild.id)) + conn.commit() + return @discord.slash_command(name="enable_tts", description="Enable TTS when chatting") async def enable_tts(self, ctx: discord.ApplicationContext): From 307427b851d3f8f6b2f6de935422a96ace260164 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 19:22:01 +0100 Subject: [PATCH 22/27] Update README.md --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 762a101..72fd011 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,31 @@ You can always disable the bot by doing **/disable** and delete your api key fro */help* - Show this command list +#Support me +You can support me by getting Botator premium, or donating [here](https://www.buymeacoffee.com/paillat). More informations here below: +##Why? +At the beginning, Botator was just a project between friends, but now many people are using it, so we need something to pay for our servers. Premium is also a way to support us and our work. +##Is this mandatory? +Not at all! You can still continue using botator for free, but in order to limit our servers overload, we limit your requests at 500 per server per day. + +##What are my advantages with premium? +With premium, we will increase the maximal number of requests to 5000 for the server of your choice. You will also have access to exclusive Discord channels and get help if you want to self-host Botator. Discord server self promote and "support us" messages will not be shown on this server + +##Am I going to have unlimited tokens with premium? +No! With premium, Botator will still use tokens from YOUR OpenAI account, but you will be able to use it 5000 times per day instead of 500. + +##How much doe it cost? +Premium subscription costs 1$ per month. + +##How can I get premium? +First join our discord server [here](https://discord.gg/pB6hXtUeDv). +Then subscribe to botator premium by clicking here: + + + +Then, link your discord account to BuyMeACoffe by following [these instructions](https://help.buymeacoffee.com/en/articles/4601477-how-do-i-access-my-discord-role). +After that you will normally be able to access some new channels in our discord server. In the Verify Premium channel, run the /premium_activate command and give your server's ID. You can learn about how to get your server's ID by clicking [here](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-). If you have any question, you can ask here: [help-getting-premium](https://discord.com/channels/1050769643180146749/1050828186159685743). + # ToDo - [ ] add image recognition - [ ] When chatgpt API is released, add that api instead of davinci-003 From cb007dd464e689549ef852c6bfbed4217aa1a71c Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 19:23:29 +0100 Subject: [PATCH 23/27] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 72fd011..764b192 100644 --- a/README.md +++ b/README.md @@ -42,23 +42,23 @@ You can always disable the bot by doing **/disable** and delete your api key fro */help* - Show this command list -#Support me -You can support me by getting Botator premium, or donating [here](https://www.buymeacoffee.com/paillat). More informations here below: -##Why? +# Support me +You can support me by getting Botator premium, or donating [here](https://www.buymeacoffee.com/paillat). More informations about botator premium here below: +### Why? At the beginning, Botator was just a project between friends, but now many people are using it, so we need something to pay for our servers. Premium is also a way to support us and our work. -##Is this mandatory? +### Is this mandatory? Not at all! You can still continue using botator for free, but in order to limit our servers overload, we limit your requests at 500 per server per day. -##What are my advantages with premium? +### What are my advantages with premium? With premium, we will increase the maximal number of requests to 5000 for the server of your choice. You will also have access to exclusive Discord channels and get help if you want to self-host Botator. Discord server self promote and "support us" messages will not be shown on this server -##Am I going to have unlimited tokens with premium? +### Am I going to have unlimited tokens with premium? No! With premium, Botator will still use tokens from YOUR OpenAI account, but you will be able to use it 5000 times per day instead of 500. -##How much doe it cost? +### How much doe it cost? Premium subscription costs 1$ per month. -##How can I get premium? +### How can I get premium? First join our discord server [here](https://discord.gg/pB6hXtUeDv). Then subscribe to botator premium by clicking here: From bff654ca0a6bc18d702b9c51e9829aa9e143470b Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 19:53:15 +0100 Subject: [PATCH 24/27] Update settings.py --- code/cogs/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/cogs/settings.py b/code/cogs/settings.py index d96b342..60f89d1 100644 --- a/code/cogs/settings.py +++ b/code/cogs/settings.py @@ -128,7 +128,7 @@ class Settings (discord.Cog) : #when someone mentions the bot, check if the guild is in the database and if the bot is enabled. If it is, send a message answering the mention @discord.slash_command(name="pretend", description="Make the bot pretend to be someone else") @discord.option(name="pretend to be...", description="The person/thing you want the bot to pretend to be. Leave blank to disable pretend mode", required=False) - async def pretend(self, ctx: discord.ApplicationContext, pretend_to_be: str): + async def pretend(self, ctx: discord.ApplicationContext, pretend_to_be: str = None): debug(f"The user {ctx.author} ran the pretend command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") #check if the guild is in the database c.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,)) From 718ef1a72056d1abf769f4587e16cf79fcba36c4 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 19:56:28 +0100 Subject: [PATCH 25/27] Update settings.py --- code/cogs/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/code/cogs/settings.py b/code/cogs/settings.py index 60f89d1..c5283e4 100644 --- a/code/cogs/settings.py +++ b/code/cogs/settings.py @@ -155,6 +155,7 @@ class Settings (discord.Cog) : ctx.guild.me.edit(nick=pretend_to_be) c.execute("UPDATE data SET pretend_to_be = ? WHERE guild_id = ?", (pretend_to_be, ctx.guild.id)) conn.commit() + await ctx.guild.me.edit(nick=pretend_to_be) return @discord.slash_command(name="enable_tts", description="Enable TTS when chatting") From a0913652baa245db1ab391b15b0fb3eff8b2adc0 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 22:51:42 +0100 Subject: [PATCH 26/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 764b192..d0cee73 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Botator is a discord bot that binds openai's gpt3 AI with discord. You will be a ![discord com_channels_1021872219888033903_1046119234033434734](https://user-images.githubusercontent.com/75439456/204105583-2abb2d77-9404-4558-bd3e-c1a70b939758.png) # Adding the bot to your discord server -In order to add the bot to your discord server, you will need an OpenAI API key. You can create an account and take one [here](https://beta.openai.com/account/api-keys) +In order to add the bot to your discord server, you will need an OpenAI API key. You can create an account and take one [here](https://beta.openai.com/account/api-keys). **Please note that you'll have 18 free credits when creating your account. They will be slowly used, and will expire 3 months after you created your accound, and when they gave all been used, you'll need to buy new tokens. You can check your tokens usage [here](https://beta.openai.com/account/usage).** You can add the bot to your server by clicking [here](https://discord.com/api/oauth2/authorize?client_id=1046051875755134996&permissions=2214808576&scope=applications.commands%20bot). **PLEASE NOTE THAT WE ARE NOT RESPONSIBLE FOR ANY MISUSE YOU'LL DO WITH THE BOT..** From 32dbed4658877ea4e018297b915030eff425aa5d Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 22:53:19 +0100 Subject: [PATCH 27/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d0cee73..5a4545e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Botator is a discord bot that binds openai's gpt3 AI with discord. You will be a ![discord com_channels_1021872219888033903_1046119234033434734](https://user-images.githubusercontent.com/75439456/204105583-2abb2d77-9404-4558-bd3e-c1a70b939758.png) # Adding the bot to your discord server -In order to add the bot to your discord server, you will need an OpenAI API key. You can create an account and take one [here](https://beta.openai.com/account/api-keys). **Please note that you'll have 18 free credits when creating your account. They will be slowly used, and will expire 3 months after you created your accound, and when they gave all been used, you'll need to buy new tokens. You can check your tokens usage [here](https://beta.openai.com/account/usage).** +In order to add the bot to your discord server, you will need an OpenAI API key. You can create an account and take one [here](https://beta.openai.com/account/api-keys). **Please note that you'll have 18$ free credits (it's really enough if you don't use the bot contineousely) when creating your account. They will be slowly used, and will expire 3 months after you created your accound, and when they gave all been used, you'll need to buy new tokens. You can check your tokens usage [here](https://beta.openai.com/account/usage).** You can add the bot to your server by clicking [here](https://discord.com/api/oauth2/authorize?client_id=1046051875755134996&permissions=2214808576&scope=applications.commands%20bot). **PLEASE NOTE THAT WE ARE NOT RESPONSIBLE FOR ANY MISUSE YOU'LL DO WITH THE BOT..**