progressed

This commit is contained in:
Honza 2024-03-15 16:02:57 +01:00
parent 0b7508be8d
commit 82e35badba

View File

@ -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 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(' ') obsah = message.content.lower().split(' ')
files = [] files = []
user_counts = [] user_counts = []
@ -111,7 +110,7 @@ async def count_reader(message): #count command returns message w
# #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
async def primenum_event(message): #primenumbers script async def primenum_command(message): #primenumbers script
vstup = int(message.content.split("~primenum ",1)[1]) vstup = int(message.content.split("~primenum ",1)[1])
@ -158,7 +157,7 @@ async def primenum_event(message): #primenumbers script
# #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
async def scprove_event(message): #scientists prove that... script async def scprove_command(message): #scientists prove that... script
input_message = str(message.content.split('~scprove',1)[1]) input_message = str(message.content.split('~scprove',1)[1])
@ -171,22 +170,34 @@ async def scprove_event(message): #scientists prove that... scri
# #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
async def help_event(message): #help script async def help_command(message): #help script
cc = '' embed = discord.Embed(title = "susbot" ,description = "Here is list of my commands and functions", colour=discord.Colour.red)
ff = '' embed.set_author(name=client.user)
for C in command_list.values(): embed.add_field(name="Commands", inline = False)
cc = cc + C.help_print() embed.add_field(name="~help", value="Command that will show you this list", inline = True)
for C in function_list.values(): embed.add_field(name="~etime", value="Command that will tell you the time :)", inline = True)
ff = ff + C.help_print() embed.add_field(name="~scprove", value="Scientist will prove you anything: ~scprove <text here>", inline = True)
final_message = '**__Commands__:**\n' + cc + '**__Functions__:**\n' + ff embed.add_field(name="~primenum", value="Bot will tell you if number is a prime number", inline = True)
await message.channel.send(final_message) embed.add_field(name="~count", value="Ask for word count of users: ~count <word>", inline = True)
return(embed)
# 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)
# #
# #
# #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
async def etime_event(message): #epoch time script async def etime_command(message): #epoch time script
await message.channel.send(time.time()) await message.channel.send(time.time())
# #
@ -194,7 +205,7 @@ async def etime_event(message): #epoch time script
# #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
async def greetings_function(message): #greetings function async def greetings_function(message): #greetings function
global t_h global t_h
if t_h + 30 < time.time(): if t_h + 30 < time.time():
for g in greetings: for g in greetings:
@ -212,7 +223,7 @@ async def greetings_function(message): #greetings function
# #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
async def sus_function(message): #sus function async def sus_function(message): #sus function
global t_s global t_s
if t_s + 20 < time.time(): if t_s + 20 < time.time():
if ('sus') in (message.content).lower() and message.content[0] != '~': if ('sus') in (message.content).lower() and message.content[0] != '~':
@ -256,13 +267,13 @@ function_list['counter'] = Function(' word counter', ' --> Bot counts how man
command_list = {} command_list = {}
command_list['~etime'] = Command('~etime', ' --> Command that will tell you epoch time\n', etime_event) 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_event) 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_event) 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 <text here>*|\n', scprove_event) command_list['~scprove'] = Command('~scprove', ' --> Scientist will prove you anything: |*~scprove <text here>*|\n', scprove_command)
command_list['~count'] = Command('~count', ' --> Ask for word count of users: |*~count <word>*|\n\n', count_reader) command_list['~count'] = Command('~count', ' --> Ask for word count of users: |*~count <word>*|\n\n', count_reader)
@ -297,12 +308,24 @@ async def on_message(message):
@client.command() @client.command()
async def count(ctx): async def count(ctx):
await ctx.send("jo") 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 #accesing functions and commands hub to run commands
# if message.content.startswith('~'): # if message.content.startswith('~'):
# for cmd in command_list.keys(): # for cmd in command_list.keys():