File size: 10,769 Bytes
cbb05ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
import discord
from discord.ext import commands
from discord import app_commands
import random
import asyncio
from datetime import datetime

CYBER_BLUE = discord.Color.from_rgb(52, 152, 219)
CYBER_ORANGE = discord.Color.from_rgb(230, 126, 34)
CYBER_GREEN = discord.Color.from_rgb(46, 204, 113)
CYBER_RED = discord.Color.from_rgb(231, 76, 60)

ESPRILER = [
    "Geçen gün bir taksi çevirdim, hala dönüyor.",
    "Adamın biri gülmüş, saksıya koymuşlar.",
    "Rüzgar esmiş, fırtına çıkmış, ben çıkamamışım.",
    "Sinemada on dakika ara verdi, ben vermedim.",
    "Geçen gün bir yazı yazdım, mürekkep bitti, tükenmez kalemle devam ettim.",
    "Yıkanan ton balığına ne denir? Yıkanmış ton balığı.",
    "Ben yürüyelim diyorum, o yollar yürümekle aşınmaz diyor.",
    "En temiz böcek hangisidir? Hamam böceği.",
    "Soru: Adamın biri uçurumdan atlayacakmış, vazgeçmiş neden? Çünkü vazgeçmiş.",
    "Su içmek ücretsiz, ama su faturası ücretli. Hayat paradoks.",
    "İki sıfır bir görüşmüş, üç olmak için.",
    "Çöpçü olmak istiyorum, hayatta bir şeyleri çöp etmek için."
]

TRIVIA_QUESTIONS = [
    {"q": "Türkiye Cumhuriyeti'nin kurucusu kimdir?", "a": "atatürk"},
    {"q": "Gökyüzü neden mavi görünür?", "a": "saçılma"},
    {"q": "Dünyanın en yüksek dağı hangisidir?", "a": "everest"},
    {"q": "Suyu oluşturan hidrojen ve hangi elementtir?", "a": "oksijen"},
    {"q": "İstiklal Marşı'mızın şairi kimdir?", "a": "mehmet akif"},
    {"q": "İstanbul hangi yıl fethedilmiştir?", "a": "1453"},
    {"q": "Kız Kulesi hangi şehrimizdedir?", "a": "istanbul"},
    {"q": "Dünya Güneş etrafındaki dönüşünü kaç günde tamamlar?", "a": "365"},
    {"q": "Python programlama dilini kim yarattı?", "a": "guido"},
    {"q": "Dünyanın en büyük okyanusu hangisidir?", "a": "pasifik"},
    {"q": "Discord hangi yılda kurulmuştur?", "a": "2015"},
    {"q": "Pi sayısının ilk üç hanesi nedir?", "a": "3.14"},
    {"q": "Türkiye'nin başkenti neresidir?", "a": "ankara"},
    {"q": "HTML neyin kısaltmasıdır?", "a": "hypertext"},
    {"q": "Avrupa'nın en büyük ülkesi hangisidir?", "a": "rusya"},
]

# Aktif trivia kanallarını takip et (aynı anda birden fazla olmasın)
ACTIVE_TRIVIA = set()


class Fun(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command(name="yazıtura", description="Yazı mı tura mı? Parayı fırlatır.")
    async def yazitura(self, ctx: commands.Context):
        result = random.choice(["Yazı ✍️", "Tura 🔵"])
        embed = discord.Embed(
            title="🪙 Yazı Tura",
            description=f"{ctx.author.mention} parayı fırlatıyor...\n\n⏳ *Para havada dönüyor...*",
            color=CYBER_ORANGE
        )
        msg = await ctx.send(embed=embed)
        await asyncio.sleep(1.5)
        embed.description = f"{ctx.author.mention} parayı fırlattı!\n\n🪙 Sonuç: **{result}**"
        await msg.edit(embed=embed)

    @commands.command(name="zar-at", description="6 yüzlü bir zar atar.")
    async def zar_at(self, ctx: commands.Context):
        zar_gorselleri = {1: "⚀", 2: "⚁", 3: "⚂", 4: "⚃", 5: "⚄", 6: "⚅"}
        zar = random.randint(1, 6)
        embed = discord.Embed(
            title="🎲 Zar Atıldı",
            description=f"{ctx.author.mention} zarı attı!\n\n{zar_gorselleri[zar]} **{zar}** geldi!",
            color=CYBER_BLUE
        )
        await ctx.send(embed=embed)

    @commands.command(name="aşk-ölçer", description="İki üye arasındaki aşk uyumunu ölçer.")
    async def ask_olcer(self, ctx: commands.Context, uye1: discord.Member, uye2: discord.Member = None):
        if uye2 is None:
            uye2 = ctx.author

        oran = random.randint(0, 100)

        if oran < 30:
            mesaj = "💔 Pek umut yok gibi duruyor, arkadaş kalmanız daha hayırlı."
        elif oran < 60:
            mesaj = "💛 İdare eder bir çekim var ama çabalamanız lazım."
        elif oran < 85:
            mesaj = "💖 Harika bir uyum! Gelecek vadediyor."
        else:
            mesaj = "💞 Efsanevi Aşk! Bir elmanın iki yarısı gibisiniz!"

        dolu_blok = int(oran / 10)
        bos_blok = 10 - dolu_blok
        cubuk = "❤️" * dolu_blok + "🖤" * bos_blok

        embed = discord.Embed(
            title="💘 Aşk Ölçer",
            description=(
                f"💘 **{uye1.display_name}** ile **{uye2.display_name}** arasındaki aşk oranı:\n\n"
                f"**Oran:** `%{oran}`\n"
                f"{cubuk}\n\n"
                f"{mesaj}"
            ),
            color=discord.Color.from_rgb(231, 76, 60),
            timestamp=datetime.now()
        )
        await ctx.send(embed=embed)

    @commands.command(name="slot", description="Şansınızı meyve slot makinesinde deneyin.")
    async def slot(self, ctx: commands.Context):
        emoji_list = ["🍎", "🍋", "🍇", "🍒", "💎", "⭐", "🍉", "🔔"]
        slot1 = random.choice(emoji_list)
        slot2 = random.choice(emoji_list)
        slot3 = random.choice(emoji_list)

        if slot1 == slot2 == slot3:
            status = "🎉 **TEBRİKLER! JACKPOT!** 🎉"
            color = CYBER_GREEN
        elif slot1 == slot2 or slot2 == slot3 or slot1 == slot3:
            status = "✨ **Çok yakındı! Amorti aldınız!** ✨"
            color = CYBER_BLUE
        else:
            status = "❌ **Kaybettiniz. Tekrar deneyin!** ❌"
            color = CYBER_RED

        embed = discord.Embed(
            title="🎰 Slot Makinesi",
            description="🎰 Makine dönüyor...\n\n`[ ⌛ | ⌛ | ⌛ ]`",
            color=CYBER_ORANGE
        )
        msg = await ctx.send(embed=embed)
        await asyncio.sleep(1.5)
        embed.title = "🎰 Slot Sonucu"
        embed.description = f"{ctx.author.mention} slot çevirdi:\n\n`[ {slot1} | {slot2} | {slot3} ]`\n\n{status}"
        embed.color = color
        await msg.edit(embed=embed)

    @commands.command(name="espri", description="Komik/soğuk bir espri yapar.")
    async def espri(self, ctx: commands.Context):
        random_espri = random.choice(ESPRILER)
        embed = discord.Embed(
            title="😂 Günün Esprisi",
            description=f"*{random_espri}*",
            color=CYBER_ORANGE
        )
        await ctx.send(embed=embed)

    @commands.command(name="bilgi-yarışması", description="Genel kültür bilgi yarışması başlatır.")
    async def bilgi_yarismasi(self, ctx: commands.Context):
        channel_id = ctx.channel.id

        # Aynı kanalda zaten aktif bir yarışma var mı kontrol et
        if channel_id in ACTIVE_TRIVIA:
            await ctx.send("⚠️ Bu kanalda zaten devam eden bir bilgi yarışması var! Önce bitmesini bekleyin.")
            return

        ACTIVE_TRIVIA.add(channel_id)
        question_data = random.choice(TRIVIA_QUESTIONS)
        correct_answer = question_data['a']

        try:
            embed = discord.Embed(
                title="🧠 Bilgi Yarışması Başladı!",
                description=(
                    f"**Soru:** {question_data['q']}\n\n"
                    f"⏱️ *Cevap vermek için 30 saniyeniz var!*\n"
                    f"💡 *Cevabınızı buraya yazın.*"
                ),
                color=CYBER_BLUE,
                timestamp=datetime.now()
            )
            embed.set_footer(text="ArazAI Bot • Bilgi Yarışması")

            await ctx.send(embed=embed)

            # Cevabı bekle - her zaman ctx.channel.send kullan (interaction sorunu yok)
            def check(m: discord.Message):
                return (
                    m.channel.id == channel_id
                    and not m.author.bot
                    and correct_answer.lower() in m.content.lower()
                )

            try:
                msg = await self.bot.wait_for("message", check=check, timeout=30.0)

                success_embed = discord.Embed(
                    title="🏆 Doğru Cevap Verildi!",
                    description=(
                        f"Tebrikler {msg.author.mention}! 🎉\n\n"
                        f"**Soru:** {question_data['q']}\n"
                        f"**Doğru Cevap:** {question_data['a'].title()}"
                    ),
                    color=CYBER_GREEN,
                    timestamp=datetime.now()
                )
                success_embed.set_thumbnail(url=msg.author.display_avatar.url)
                await ctx.channel.send(embed=success_embed)

            except asyncio.TimeoutError:
                timeout_embed = discord.Embed(
                    title="⏰ Süre Doldu!",
                    description=(
                        f"Kimse doğru cevabı veremedi. 😔\n\n"
                        f"**Soru:** {question_data['q']}\n"
                        f"**Doğru Cevap:** {question_data['a'].title()}"
                    ),
                    color=CYBER_RED,
                    timestamp=datetime.now()
                )
                await ctx.channel.send(embed=timeout_embed)

        finally:
            # Yarışma her durumda aktif listeden kaldırılsın
            ACTIVE_TRIVIA.discard(channel_id)

    @commands.command(name="avatar", description="Belirtilen üyenin avatarını büyük boyutta gösterir.")
    async def avatar(self, ctx: commands.Context, member: discord.Member = None):
        member = member or ctx.author
        embed = discord.Embed(
            title=f"🖼️ {member.display_name} Avatarı",
            color=CYBER_BLUE
        )
        embed.set_image(url=member.display_avatar.url)
        embed.set_footer(text=f"İstekte bulunan: {ctx.author.display_name}")
        await ctx.send(embed=embed)

    @commands.command(name="8top", description="Sihirli 8 top ile sorunuzu yanıtlar.")
    async def sekiz_top(self, ctx: commands.Context, *, soru: str):
        cevaplar = [
            "✅ Kesinlikle evet!", "✅ Buna kesin olarak güvenebilirsin.",
            "✅ Evet, şüphesiz.", "✅ Görünüşe göre evet.",
            "🤔 Cevabım belirsiz, tekrar dene.", "🤔 Şimdi tahmin edemiyorum.",
            "🤔 Şimdi sorma, daha sonra sor.", "🤔 Daha fazla konsantre ol ve tekrar sor.",
            "❌ Buna güvenme.", "❌ Cevabım hayır.", "❌ Görünüşe göre hayır.", "❌ Kesinlikle hayır."
        ]
        cevap = random.choice(cevaplar)
        embed = discord.Embed(
            title="🎱 Sihirli 8 Top",
            description=f"**Soru:** {soru}\n\n**Cevap:** {cevap}",
            color=CYBER_BLUE
        )
        await ctx.send(embed=embed)


async def setup(bot):
    await bot.add_cog(Fun(bot))