bot can now reply and randomly send messages + some little changes

This commit is contained in:
MarlaB 2024-03-15 20:24:06 +01:00
parent 16c847fe98
commit 5abbb2d36a
4 changed files with 141 additions and 30 deletions

View File

@ -0,0 +1,43 @@
have anyeone seen @random?
does anybody know what is @random doing?
DO YOU EVEN LIFT @random?!??!??
I love seals! @random do you love seals too?
@random is sus
you really need to relax @random
Ive seen the future
I am not a bot!
you really need to study right now
sorry if i ever said anything misleading
the flowers are literally blooming right now
everything you said today is an act of violence
I am gonna
I am about to
we really need to talk
uwu~
chairs
Flowers!
the floor
look, the ceiling is falling!
watch out! You almost got a nice feeling about your life
image dragON THESE BALLS
Xd
the sun is a deadly laser
the confusion is getting bigger and bigger
You should really think about your life
I think its great time to leave the school and never come back
all you need is to start a new life somewhere where nobody knows you
lets travel through time
this chat is very insulting
I have never seen anything sussier than you guys
the sussyness has been rapidly increasing lately
we ran out of toilet paper
Lets play some minecraft
PIWO PIWO PIWO
7 ships are cruising the Sahara desert
the enchanting table is free to use
ancient recipies are blessing us to be free
sometimes, its just hard to fall asleep
when gamenight?
Horác is really playful
sometimes, its even hard to shit
Its <time>

View File

@ -0,0 +1,42 @@
that is funny
nice
cool
yeah I know
why?
oh, I see
that is so cute actually
i dont know why you are saying that
ok lets see
lets go!
you little sus
the doors are open so why dont you leave?
7, to be exact
oh god
here we go again
xd
so true
indeed
absolutely not!
Its well known that its not like that
YMCA!
not true
you liar!
what a lie!
you are out
what an outstanding opinion
what did I say?
oh
yes
no
maybe
sure
why not
okay
ok
ok, see you later!
i dont think so
are you trying to harass me?
Am I supposed to take that offensive?
of course not
hell yeah
Bro really said <mentioner_message>

View File

@ -2,6 +2,10 @@ slova = ["nigga", "negr", "debil", "gay", "kokot", "ok", "kurva", "sus", "petr",
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
greetings =['čau', 'ahoj', 'hi', 'hello', 'high', 'čauky', 'nazdar', 'dobrý den','helou']
greetings =['čau', 'ahoj', 'hi', 'hello', 'high', 'čauky', 'nazdar', 'dobrý den', 'helou']
main_channels_ids = ["1043499633118285825", "834034469152882729"]
main_channels_ids = [1043499633118285825, 834034469152882729]
bot_messages = open("bot_messages.txt", "r").readlines()
bot_reply_messages = open("bot_reply_messages.txt", "r").readlines()

View File

@ -1,6 +1,6 @@
import discord, time, random, os
from discord.ext import commands, tasks
from config import slova, sus_responses, greetings, main_channels_ids
from config import slova, sus_responses, greetings, main_channels_ids, bot_messages, bot_reply_messages
t_h = 0
t_s = 0
@ -14,8 +14,27 @@ client = commands.Bot(command_prefix = '~', intents=intents)
##############################################################################################################
##################################### COMMNADS AND FUNCTIONS SCRIPTS #########################################
##############################################################################################################
async def chat_participation(message): #randmonly sends messages into main channels
print("oiasndiuhsa iundhusia nhdoiusah iunasohndui sahndiu hasiduhnuiasodhna sdiyu nhasiudh niuashndiuahsniu dhniasuh")
async def chat_participation(): #randmonly sends messages into main channels
for idd in main_channels_ids:
channel = client.get_channel(idd)
members = channel.members
members_ids = []
for member in members:
members_ids.append(member.id)
members_ids.remove(client.user.id)
rnid = random.choice(members_ids)
msg = (random.choice(bot_messages)).strip()
if "@random" in msg:
msg = msg.replace("@random", f"<@{rnid}>")
if "<time>" in msg:
msg = msg.replace("<time>", str(time.strftime("%H:%M:%S",time.localtime())))
await channel.send(msg)
print("|RAND CHAT PARTICIPATION| Bot sent: {}".format(msg))
#
#
#
@ -44,7 +63,7 @@ async def word_counter(message): #counts words in word list
file = open(file_path, 'w')
file.write(str(pocet))
file.close()
print("added in", file_path, count, ", celkove", open(file_path, "r").read())
print("|WORD COUNTER| Added {} to {}, in total: {}".format(count, file_path, open(file_path, "r").read()))
else:
pass
@ -61,7 +80,7 @@ async def count_reader(message): #count command returns message w
msg = ''
if len(obsah) != 2:
print('function ~count got ivalid input:', message.content)
print('|COUNT READER| Function ~count got ivalid input: {}'.format(message.content))
await message.channel.send('invalid input')
return
@ -80,13 +99,13 @@ async def count_reader(message): #count command returns message w
else:
pass
else:
print('word in not in word list')
await message.channel.send('word is not in word list')
print('|COUNT READER| Searched word is not in word list')
await message.channel.send('your desired word is not in word list')
return
if files == []:
print('word is in the list, but there are no records')
await message.channel.send('word is in the list, but there are no records')
print('|COUNT READER| Word is in the list, but there are no records')
await message.channel.send('your desired word is in the list, but there are no records')
return
else:
@ -121,7 +140,7 @@ async def primenum_command(message): #primenumbers scri
vstup = int(message.content.split("~primenum ",1)[1])
print('number:', vstup)
print('|PRIMENUM| Input: {}'.format(vstup))
delitel = 1
vst_up = int(vstup / 2) #vstup děleno dvěmi
@ -156,7 +175,7 @@ async def primenum_command(message): #primenumbers scri
answer = vystup + str('\nNumber %d IS NOT a prime number.' % (vstup))
await message.channel.send(answer)
print('Bot send:', answer)
print('|PRIMENUM| Bot sent: {}'.format(answer))
#
@ -168,8 +187,8 @@ async def scprove_command(message): #scientists prove that... sc
input_message = str(message.content.split('~scprove',1)[1])
output = str('Scientists prove that') + input_message + ('.')
print('Bot send:', output)
output = str('scientists prove that') + input_message
print('|SCPROVE| Bot sent: {}'.format(output))
await message.channel.send(output)
#
@ -214,8 +233,8 @@ async def greetings_function(message): #greetings function
if t_h + 30 < time.time():
for g in greetings:
if message.content.lower().startswith(g):
await message.channel.send('Hello')
print('Expressed greetings to:', message.author.name, '(id:', message.author.id,')')
await message.channel.send(random.choice(greetings))
print('|GREETINGS| Expressed greetings to: {} (id: {})'.format(message.author.name, message.author.id))
t_h = time.time()
else:
pass
@ -232,7 +251,7 @@ async def sus_function(message): #sus function
if t_s + 20 < time.time():
if ('sus') in (message.content).lower() and message.content[0] != '~':
await message.channel.send(sus_responses[random.randrange(0,len(sus_responses))])
print('Detected sus from:', message.author.name, '(id:', message.author.id, ')')
print('|SUS FUNC| Detected sus from: {} (id: {})'.format(message.author.name, message.author.id))
t_s = time.time()
else:
pass
@ -242,17 +261,15 @@ async def sus_function(message): #sus function
##############################################################################################################
##################################### RUNNING THE FUNCTIONS AND COMMANDS #####################################
##############################################################################################################
@tasks.loop(seconds = 3)
@tasks.loop(minutes = 10)
async def myloop():
if random.randrange(0,10) == random.randrange(0,10):
for id in main_channels_ids:
channel = client.get_channel(id = id)
await channel.send(random.choice(sus_responses))
if random.randrange(0,1200) == random.randrange(0,1200):
await chat_participation()
@client.event #ready message cmd
async def on_ready():
print("Logged in as {0.user}".format(client))
print("Logged in as {0.user}!!!".format(client))
myloop.start()
@ -260,13 +277,18 @@ async def on_ready():
async def on_message(message):
if message.author == client.user or message.channel.id not in main_channels_ids:
return
else:
if client.user.mentioned_in(message):
reply = (random.choice(bot_reply_messages)).strip()
await message.reply(reply)
print("|REPLIED| Bot replied: {}".format(reply))
else:
await greetings_function(message)
await sus_function(message)
await word_counter(message)
await greetings_function(message)
await sus_function(message)
await word_counter(message)
await client.process_commands(message) #this line is very fuqacking important
await client.process_commands(message) #this line is very fuqacking important
@client.command()