👋 Etkileşim ve Sosyal Anime GIF Komutları
Kumiho Bot, sunucu üyelerinin birbirleriyle eğlenceli ve samimi bir iletişim kurabilmesi için Nekos.best ve Otakugifs REST API'lerini entegre eden zengin bir etkileşim motoruna sahiptir.
🫂 Sosyal Eylemler ve Akıllı Açılır Menü (MemberSelectView)
Kullanıcı birini etiketleyerek komut çalıştırabileceği gibi (f.hug @üye), hiç kimseyi etiketlemeden de komutu yazabilir. Bu durumda bot kullanıcıyı azarlamak yerine Discord'un interaktif discord.ui.UserSelect menüsünü sunar!
Desteklenen Eylemler:
hug (sarıl), kiss (öp), slap (tokatla), pat (okşa), cuddle (kucakla), bite (ısır), punch (yumrukla), poke (dürt), lick (yala), boop (buruna dokun), tickle (gıdıkla), wave (el salla), highfive (beşlik çak), yeet (fırlat).
Kaynak Kodu İncele: Commands/fun.py#L280-L330
# Commands/fun.py dosyasından anime GIF çekme ve fallback algoritması
# https://github.com/mrKyrik/foxy-bot/blob/main/Commands/fun.py#L305-L330
async def get_reaction_gif(self, action: str) -> str:
"""Nekos.best veya Otakugifs API'sinden asenkron GIF çeker. Hata durumunda statik Giphy'e düşer."""
if action in ("lick", "boop"):
url = f"https://api.otakugifs.xyz/gif?reaction={action}"
else:
url = f"https://nekos.best/api/v2/{action}"
try:
async with aiohttp.ClientSession() as session:
async with session.get(url, timeout=aiohttp.ClientTimeout(total=5)) as resp:
if resp.status == 200:
data = await resp.json()
results = data.get("results", [])
if results:
return results[0].get("url")
except Exception:
pass
return fallbacks.get(action, "https://media.giphy.com/media/V8E0wV5D1fSSY/giphy.gif")
👁️ Discord Embed Önizlemesi (Sosyal Etkileşim):
🎭 Bireysel Duygu İfadeleri
Kimseyi etiketlemeden sadece kendi anlık duygunuzu kanala yansıtmak için:
f.cry(Ağlama)f.laugh(Gülme)f.dance(Dans Etme)f.blush(Kızarma/Utanma)
💻 Kopyala-Yapıştır: Kendi Botunuza Anime GIF Reaksiyon Komutu Ekleyin
Yeni başlayan yazılımcılar için asenkron aiohttp ile Nekos.best API'sinden GIF çeken çalışan bağımsız Cog:
"""
anime_reactions_cog.py
Nekos.best API'si üzerinden çalışan Discord anime reaksiyon Cog'u.
Gereksinim: pip install aiohttp
"""
import aiohttp
import discord
from discord.ext import commands
class ReactionsCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
async def fetch_gif(self, endpoint: str) -> str:
url = f"https://nekos.best/api/v2/{endpoint}"
try:
async with aiohttp.ClientSession() as session:
async with session.get(url, timeout=aiohttp.ClientTimeout(total=4)) as resp:
if resp.status == 200:
data = await resp.json()
return data["results"][0]["url"]
except Exception:
return "https://media.giphy.com/media/od5H3PmEG5EVq/giphy.gif"
@commands.command(name="saril", aliases=["hug"])
async def hug_cmd(self, ctx: commands.Context, member: discord.Member = None):
"""Bir üyeye sımsıkı sarılır."""
if not member:
return await ctx.send(f"Kime sarılmak istiyorsunuz? Kullanım: `{ctx.prefix}saril @kullanıcı`")
gif_url = await self.fetch_gif("hug")
embed = discord.Embed(
description=f"💖 {ctx.author.mention}, {member.mention} kullanıcısına sımsıkı sarıldı!",
color=discord.Color.magenta()
)
embed.set_image(url=gif_url)
await ctx.send(embed=embed)
async def setup(bot):
await bot.add_cog(ReactionsCog(bot))