From 6e752603786ae2a05ed208430b5401b8d57dd31f Mon Sep 17 00:00:00 2001 From: MarlaB Date: Fri, 15 Mar 2024 16:52:38 +0100 Subject: [PATCH 1/2] dasdasoihjdosa --- bot_newest_version/susmain3.py | 85 ++-------------------------------- 1 file changed, 4 insertions(+), 81 deletions(-) diff --git a/bot_newest_version/susmain3.py b/bot_newest_version/susmain3.py index 780e7bf..e6ef7f5 100644 --- a/bot_newest_version/susmain3.py +++ b/bot_newest_version/susmain3.py @@ -14,7 +14,7 @@ client = commands.Bot(command_prefix = '~', intents=intents) ############################################################################################################## ##################################### COMMNADS AND FUNCTIONS SCRIPTS ######################################### ############################################################################################################## -async def word_counter(message): #counts words in word list +async def word_counter(message): #counts words in word list for slovo in slova: if slovo in message.content.lower() and message.content[0] != '~': @@ -48,6 +48,7 @@ async def word_counter(message): #counts words in word list # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # async def count_reader(message): #count command returns message with counts of certain word of all users + message = message.message obsah = message.content.lower().split(' ') files = [] user_counts = [] @@ -179,19 +180,8 @@ async def help_command(message): #help script embed.add_field(name="~scprove", value="Scientist will prove you anything: ~scprove ", inline = True) embed.add_field(name="~primenum", value="Bot will tell you if number is a prime number", inline = True) embed.add_field(name="~count", value="Ask for word count of users: ~count ", inline = True) - - return(embed) + await message.channel.send("ahoj") - -# cc = '' -# ff = '' -# for C in command_list.values(): -# cc = cc + C.help_print() -# for C in function_list.values(): -# ff = ff + C.help_print() -# final_message = '**__Commands__:**\n' + cc + '**__Functions__:**\n' + ff -# await message.channel.send(final_message) - # # # @@ -239,46 +229,6 @@ async def sus_function(message): #sus function ##################################### FUNCTIONS AND COMMANDS HUB ############################################# ############################################################################################################## -class Command: - def __init__(self, caller, desc, script): - self.caller = caller - self.desc = desc - self.script = script - def help_print(self): - return ('%s %s' % (self.caller, self.desc)) - -class Function: - def __init__(self, caller, desc): - self.caller = caller - self.desc = desc - def help_print(self): - return ('%s %s' % (self.caller, self.desc)) - - -function_list = {} - - -function_list['sus'] = Function(' sus', ' --> Bot knows when something is sus\n') - -function_list['hello'] = Function(' greetings', ' --> Bot greets you back\n') - -function_list['counter'] = Function(' word counter', ' --> Bot counts how many times you have written certain words') - -command_list = {} - - -command_list['~etime'] = Command('~etime', ' --> Command that will tell you epoch time\n', etime_command) - -command_list['~help'] = Command('~help', ' --> Command that will show you this list\n', help_command) - -command_list['~primenum'] = Command('~primenum', ' --> Bot will tell you if number is a prime number (number of six digits max.)\n', primenum_command) - -command_list['~scprove'] = Command('~scprove', ' --> Scientist will prove you anything: |*~scprove *|\n', scprove_command) - -command_list['~count'] = Command('~count', ' --> Ask for word count of users: |*~count *|\n\n', count_reader) - - - slova = ["nigga", "negr", "debil", "gay", "kokot", "ok", "kurva", "sus", "petr", "gej", "bruh", "bružek"] #words bot recognize and count sus_responses = ["it's getting sus here", "sus", "you are sussy", "sussy baka", "that is kinda sus", "that is sus", "you're seeming sus lately", "seems sus", "SUS", "gobus amogus", "amongsus", "sussy ah", "sussy"] #variety of responses when sus detection @@ -308,37 +258,10 @@ async def on_message(message): @client.command() async def count(ctx): - await count_reader(ctx.message) + await count_reader(ctx) -@client.command() -async def help(ctx): - await ctx.send(help_command(ctx.message)) -@client.command() -async def etime(ctx): - await etime_command(ctx.message) -@client.command() -async def primenum(ctx): - await primenum_command(ctx.message) - -@client.command() -async def scprove(ctx): - await scprove_command(ctx.message) - -#accesing functions and commands hub to run commands -# if message.content.startswith('~'): -# for cmd in command_list.keys(): -# if message.content.lower().startswith(cmd): -# c = command_list[cmd] -# print(message.author.name, '(id:', message.author.id, ')', 'called',c.caller) -# await c.script(message) -# break -# -# else: -# pass -# else: -# pass TOKEN = open("../sus_bot_token.txt", 'r').read() client.run(TOKEN) From 2d181070cc73b4aea64f161cdb8c4b32165c8981 Mon Sep 17 00:00:00 2001 From: MarlaB Date: Fri, 15 Mar 2024 17:30:43 +0100 Subject: [PATCH 2/2] now it is working brh --- bot_newest_version/susmain3.py | 41 +++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/bot_newest_version/susmain3.py b/bot_newest_version/susmain3.py index e6ef7f5..819f3a2 100644 --- a/bot_newest_version/susmain3.py +++ b/bot_newest_version/susmain3.py @@ -48,7 +48,6 @@ async def word_counter(message): #counts words in word list # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # async def count_reader(message): #count command returns message with counts of certain word of all users - message = message.message obsah = message.content.lower().split(' ') files = [] user_counts = [] @@ -172,15 +171,17 @@ async def scprove_command(message): #scientists prove that... sc # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # async def help_command(message): #help script - embed = discord.Embed(title = "susbot" ,description = "Here is list of my commands and functions", colour=discord.Colour.red) - embed.set_author(name=client.user) - embed.add_field(name="Commands", inline = False) - embed.add_field(name="~help", value="Command that will show you this list", inline = True) - embed.add_field(name="~etime", value="Command that will tell you the time :)", inline = True) - embed.add_field(name="~scprove", value="Scientist will prove you anything: ~scprove ", inline = True) - embed.add_field(name="~primenum", value="Bot will tell you if number is a prime number", inline = True) - embed.add_field(name="~count", value="Ask for word count of users: ~count ", inline = True) - await message.channel.send("ahoj") + embed1 = discord.Embed(title = "__Commands__" ,description = None, colour=discord.Colour.red()) + embed1.set_author(name=client.user.name) + embed1.add_field(name="~help", value="-- Command that will show you this list", inline = False) + embed1.add_field(name="~etime", value="-- Command that will tell you the time :)", inline = False) + embed1.add_field(name="~scprove", value="-- Scientist will prove you anything: ~scprove ", inline = False) + embed1.add_field(name="~primenum", value="-- Bot will tell you if number is a prime number", inline = False) + embed1.add_field(name="~count", value="-- Ask for word count of users: ~count ", inline = False) + + embed2 = discord.Embed(title = "__Functions__" ,description = None, colour=discord.Colour.red()) + embed.addfield(name="") + await message.channel.send(embed=embed1) # # @@ -251,17 +252,31 @@ async def on_message(message): else: await greetings_function(message) - await sus_function(message) - await word_counter(message) + + await client.process_commands(message) + @client.command() async def count(ctx): - await count_reader(ctx) + await count_reader(ctx.message) +@client.command() +async def pomoc(ctx): + await (help_command(ctx.message)) +@client.command() +async def etime(ctx): + await etime_command(ctx.message) +@client.command() +async def primenum(ctx): + await primenum_command(ctx.message) + +@client.command() +async def scprove(ctx): + await scprove_command(ctx.message) TOKEN = open("../sus_bot_token.txt", 'r').read() client.run(TOKEN)