Untitled
Bilal
python
2 years ago
1.8 kB
8
Indexable
import discord
from discord.ext import commands
import configparser
# Config dosyasını yükle
config = configparser.ConfigParser()
config.read('config.ini')
# Botunuzun komut öneki ve token'ını alın
prefix = config['Bot']['prefix']
TOKEN = config['Bot']['token']
# Intents tanımlayın
intents = discord.Intents.default()
intents.members = True # Kullanıcı listesini almak için gerekli
intents.message_content = True
# Bot oluşturun
bot = commands.Bot(command_prefix=prefix, intents=intents)
# Belirli kullanıcı adı
target_user = "furious041"
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name}')
# Botun durumunu ayarla
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.competing, name="Discord"))
@bot.event
async def on_message(message):
# Eğer mesaj bot tarafından gönderilmişse işlem yapmayın
if message.author == bot.user:
return
# Eğer mesaj "merhaba" içeriyorsa, altına emoji ile tepki ekle
if "ivy" in message.content.lower():
await message.add_reaction("❤️")
# Belirli kullanıcı etiketlendiğinde
if message.mentions:
for mention in message.mentions:
if mention.name == target_user:
# Belirli kullanıcı etiketlendiğinde kalp emojisi ile tepki ver
await message.add_reaction("❤️")
# Komutlar için mesajın ön işlemesi
await bot.process_commands(message)
# !avatar komutunu tanımlayın
@bot.command(name='avatar')
async def _avatar(ctx, member: discord.Member = None):
member = member or ctx.author
await ctx.send(member.avatar)
# Botu çalıştırın
bot.run(TOKEN)Editor is loading...
Leave a Comment