Apr-23-2021, 11:37 AM
Hello I'm trying to create a discord bot and I'm stuck one subject. I want to share a random photo from a folder when someone write in the chat specific words. For example when someone write 'dog', ı want to share a dog photo from a folder. I'll show my basic code I hope you will help me.
import os import random import discord from discord.ext import commands my_files = [discord.File('A:\\ma\\1.jpg'), discord.File('A:\\ma\\2.jpg')] bat = ['dog', 'cat'] . . . if any(word in msg for word in bat): await message.channel.send(files=my_files)