99 lines
3.0 KiB
Python
99 lines
3.0 KiB
Python
import aiohttp
|
|
import datetime
|
|
import os
|
|
import random
|
|
from typing import List, Literal, Optional
|
|
|
|
import discord
|
|
from discord.ext import commands
|
|
import pnwkit
|
|
from pnwkit import Order, OrderBy
|
|
|
|
from botclass import Brahmos, CustomCtx
|
|
|
|
|
|
class Misc(commands.Cog):
|
|
def __init__(self, bot: Brahmos):
|
|
self.bot = bot
|
|
self.kit = pnwkit.QueryKit(
|
|
api_key=os.getenv("pnwAPIKEY"),
|
|
bot_key=os.getenv("pnwBOTKEY"),
|
|
bot_key_api_key=os.getenv("pnwACCKEY"),
|
|
aiohttp_session=aiohttp.ClientSession(loop=self.bot.loop),
|
|
)
|
|
self.dkit = pnwkit.QueryKit(
|
|
api_key=os.getenv("pnwDILFKEY"),
|
|
bot_key=os.getenv("pnwBOTKEY"),
|
|
bot_key_api_key=os.getenv("pnwACCKEY"),
|
|
aiohttp_session=aiohttp.ClientSession(loop=self.bot.loop),
|
|
)
|
|
|
|
@commands.command(name="sex")
|
|
async def sex(self, ctx: CustomCtx):
|
|
"""
|
|
sex
|
|
"""
|
|
replies_rare = [
|
|
"https://media.discordapp.net/attachments/943540698492334123/1215965590037069944/QQmVi9s.png",
|
|
"https://tenor.com/view/houshou-marine-sexy-treasure-box-im-your-treasure-box-ride-gif-26351095",
|
|
]
|
|
|
|
replies_common = [
|
|
"# SEXOOOO",
|
|
"nope",
|
|
"kys",
|
|
"yes",
|
|
"not with u lmao",
|
|
"in your dreams",
|
|
"no",
|
|
]
|
|
|
|
num = random.randint(1, 10)
|
|
reply = random.choice(replies_common)
|
|
if num <= 2:
|
|
reply = replies_rare[random.randint(0, 1)]
|
|
await ctx.send(reply)
|
|
|
|
@commands.command(name="snowflake")
|
|
async def snowflake(self, ctx: CustomCtx, snowflake: int):
|
|
"""
|
|
get snowflake info
|
|
"""
|
|
snowflake = discord.utils.snowflake_time(snowflake)
|
|
embed = discord.Embed(
|
|
title="Snowflake Info",
|
|
description=f"Snowflake: {snowflake}\n"
|
|
f"Date: {snowflake.strftime('%Y-%m-%d %H:%M:%S')}\n"
|
|
f"Timestamp: {snowflake.timestamp()}",
|
|
color=0x2F3136,
|
|
)
|
|
await ctx.send(embed=embed)
|
|
|
|
@commands.command(name="alliance")
|
|
async def alliance(self, ctx: CustomCtx, id: Optional[int] = 10177):
|
|
try:
|
|
result = await self.kit.query(
|
|
"nations",
|
|
{"alliance_id": id,
|
|
"orderBy": OrderBy("cities", Order.DESC),
|
|
"first": 300
|
|
},
|
|
"id, nation_name, num_cities, alliance {name}"
|
|
)
|
|
string = f"Nations in alliance {result.nations[0].alliance.name}\n"
|
|
i=0
|
|
for nation in result.nations:
|
|
i+=1
|
|
string += f"{i:>3}. {nation.id} c{nation.num_cities} {nation.nation_name}\n"
|
|
await ctx.cbsend(string)
|
|
except IndexError:
|
|
return await ctx.send("> alliance not found.")
|
|
except Exception as e:
|
|
return await ctx.cbsend(e)
|
|
|
|
|
|
|
|
|
|
async def setup(bot: commands.Bot):
|
|
await bot.add_cog(Misc(bot))
|