import discord, random from discord.ext import commands, tasks ### Karlovy funkce import responses_messages ### Karluv config prefix = "Karle " client = commands.Bot(command_prefix=prefix, intents=discord.Intents.all()) ################################################################################ ############################### LOOPS AND READY ################################ ################################################################################ ### chat participation loop @tasks.loop(minutes = 10) async def loop_chat_message(): if random.randrange(0,1000) == random.randrange(0,1000): await client.get_channel(834034469152882729).send(responses_messages.get_random_message()) else: pass ### ready event @client.event async def on_ready(): print(f"[ONREADY ] logged in as: {client.user}") loop_chat_message.start() ################################################################################ ############################## ON MESSAGE EVENT ################################ ################################################################################ @client.event async def on_message(message): ### chance to add reaction to the message if random.randint(1,120) == random.randint(1,120): await message.add_reaction("❤️") ### reply to mention if client.user.mentioned_in(message) and "@here" not in message.content and random.randint(1,3) == random.randint(1,3): odpoved = responses_messages.response_generator(message) if odpoved != None: await message.reply(odpoved) ### every message reply chance elif message.author != client.user and message.content.startswith(prefix) == False and random.randint(1,60) == random.randint(1,60): odpoved = responses_messages.response_generator(message) if odpoved != None: await message.reply(odpoved) await client.process_commands(message) ################################################################################ ################################ POMOC COMMAND ################################# ################################################################################ @client.command() async def pomoc(ctx): await ctx.send("Jsem pátý člen vašeho serveru a občas něco napíšu <3, nějaké info najdeš i v mém profilu") ################################################################################ ################################################################################ ################################################################################ TOKEN = open("config/token.txt", 'r').read() client.run(TOKEN)