mirror of https://codeberg.org/soteria/sox.git
build(deps): update everything to latest
This commit is contained in:
parent
fb429a12ef
commit
b70e4513d5
File diff suppressed because it is too large
Load Diff
|
|
@ -8,14 +8,14 @@ readme = "README.md"
|
||||||
package-mode = false
|
package-mode = false
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = ">3.9,<4.0"
|
python = ">3.12,<4.0"
|
||||||
disnake = "^2.9.2"
|
disnake = "^2.11.0"
|
||||||
disnake-ext-plugins = {git = "https://github.com/DisnakeCommunity/disnake-ext-plugins"}
|
disnake-ext-plugins = {git = "https://github.com/DisnakeCommunity/disnake-ext-plugins"}
|
||||||
python-dotenv = "^1.0.1"
|
python-dotenv = "^1.2.1"
|
||||||
pyteria = "^0.1.0"
|
pyteria = "^0.1.0"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
ruff = "^0.5.6"
|
ruff = "^0.15.0"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ dotenv.load_dotenv()
|
||||||
|
|
||||||
class MyBot(commands.InteractionBot):
|
class MyBot(commands.InteractionBot):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(intents=disnake.Intents.all())
|
super().__init__(intents=disnake.Intents.none()) # temporary
|
||||||
|
|
||||||
async def on_message(self, message: disnake.Message):
|
async def on_message(self, message: disnake.Message):
|
||||||
if "rewrite" in message.content.lower() and "rust" in message.content.lower() and message.guild.id == int(os.environ["FUN_GUILD"]):
|
if "rewrite" in message.content.lower() and "rust" in message.content.lower() and message.guild.id == int(os.environ["FUN_GUILD"]):
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,28 @@
|
||||||
from disnake.ext import plugins
|
|
||||||
|
|
||||||
import disnake
|
import disnake
|
||||||
|
import disnake_plugins as plugins
|
||||||
|
|
||||||
plugin = plugins.Plugin()
|
plugin = plugins.Plugin()
|
||||||
|
|
||||||
|
|
||||||
@plugin.slash_command(description="ping da bot real")
|
@plugin.slash_command(description="ping da bot real")
|
||||||
async def ping(inter: disnake.CommandInteraction):
|
async def ping(inter: disnake.CommandInteraction):
|
||||||
em = disnake.Embed(title="Pong!", description=f"Ping - {int(plugin.bot.latency * 1000)}ms\nWritten with love in Python")
|
em = disnake.Embed(
|
||||||
em.set_thumbnail(plugin.bot.user.avatar.url)
|
title="Pong!",
|
||||||
|
description=f"Ping - {int(plugin.bot.latency * 1000)}ms\nWritten with love in Python",
|
||||||
|
)
|
||||||
|
em.set_thumbnail(plugin.bot.user.display_avatar.url)
|
||||||
await inter.response.send_message(embed=em)
|
await inter.response.send_message(embed=em)
|
||||||
|
|
||||||
|
|
||||||
@plugin.slash_command(description="help me!", name="help")
|
@plugin.slash_command(description="help me!", name="help")
|
||||||
async def help_command(inter: disnake.CommandInteraction):
|
async def help_command(inter: disnake.CommandInteraction):
|
||||||
desc = ""
|
desc = ""
|
||||||
for cmd in plugin.bot.global_application_commands:
|
for cmd in plugin.bot.global_application_commands:
|
||||||
desc += f"**{cmd.name}** - {cmd.description}\n\n"
|
desc += f"**{cmd.name}** - {cmd.description}\n\n"
|
||||||
|
|
||||||
em = disnake.Embed(title="Commands", description=desc)
|
em = disnake.Embed(title="Commands", description=desc)
|
||||||
if plugin.bot.user.avatar:
|
em.set_thumbnail(plugin.bot.user.display_avatar.url)
|
||||||
em.set_thumbnail(plugin.bot.user.avatar.url)
|
|
||||||
await inter.response.send_message(embed=em)
|
await inter.response.send_message(embed=em)
|
||||||
|
|
||||||
setup, teardown = plugin.create_extension_handlers()
|
|
||||||
|
setup, teardown = plugin.create_extension_handlers()
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,24 @@
|
||||||
from disnake.ext import plugins
|
|
||||||
|
|
||||||
import disnake
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
import disnake
|
||||||
|
import disnake_plugins as plugins
|
||||||
|
|
||||||
plugin = plugins.Plugin()
|
plugin = plugins.Plugin()
|
||||||
|
|
||||||
|
|
||||||
@plugin.slash_command(description="tells a (maybe) funny joke")
|
@plugin.slash_command(description="tells a (maybe) funny joke")
|
||||||
async def joke(inter: disnake.CommandInteraction):
|
async def joke(inter: disnake.CommandInteraction):
|
||||||
async with aiohttp.ClientSession() as cs:
|
async with aiohttp.ClientSession() as cs:
|
||||||
async with cs.get("https://v2.jokeapi.dev/joke/Programming,Miscellaneous?blacklistFlags=nsfw,political&type=single") as resp:
|
async with cs.get(
|
||||||
|
"https://v2.jokeapi.dev/joke/Programming,Miscellaneous?blacklistFlags=nsfw,political&type=single"
|
||||||
|
) as resp:
|
||||||
resp = await resp.json()
|
resp = await resp.json()
|
||||||
em = disnake.Embed(title="A joke for you!", description=resp["joke"], color=disnake.Color.random())
|
em = disnake.Embed(
|
||||||
|
title="A joke for you!",
|
||||||
|
description=resp["joke"],
|
||||||
|
color=disnake.Color.random(),
|
||||||
|
)
|
||||||
em.set_footer(text="powered by v2.jokeapi.dev")
|
em.set_footer(text="powered by v2.jokeapi.dev")
|
||||||
await inter.response.send_message(embed=em)
|
await inter.response.send_message(embed=em)
|
||||||
|
|
||||||
setup, teardown = plugin.create_extension_handlers()
|
|
||||||
|
setup, teardown = plugin.create_extension_handlers()
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,36 @@
|
||||||
from disnake.ext import plugins
|
|
||||||
|
|
||||||
import disnake
|
import disnake
|
||||||
|
import disnake_plugins as plugins
|
||||||
import soteria
|
import soteria
|
||||||
|
|
||||||
plugin = plugins.Plugin()
|
plugin = plugins.Plugin()
|
||||||
|
|
||||||
sot = soteria.Client(cache=soteria.MemoryCache())
|
sot = soteria.Client(cache=soteria.MemoryCache())
|
||||||
|
|
||||||
|
|
||||||
@plugin.unload_hook()
|
@plugin.unload_hook()
|
||||||
async def close_sot():
|
async def close_sot():
|
||||||
await sot.close()
|
await sot.close()
|
||||||
|
|
||||||
|
|
||||||
@plugin.slash_command(description="gets the 5 most recent BANGERS (posts) from Soteria")
|
@plugin.slash_command(description="gets the 5 most recent BANGERS (posts) from Soteria")
|
||||||
async def get_posts(inter: disnake.CommandInteraction):
|
async def get_posts(inter: disnake.CommandInteraction):
|
||||||
await inter.response.defer()
|
await inter.response.defer()
|
||||||
r = await sot.request('GET', '/posts/all', params={"limit": 5})
|
r = await sot.request("GET", "/posts/all", params={"limit": 5})
|
||||||
embed_list = []
|
embed_list = []
|
||||||
for post in r:
|
for post in r:
|
||||||
user = await soteria.User.fetch(sot, post["author"])
|
user = await soteria.User.fetch(sot, post["author"])
|
||||||
|
|
||||||
embed = disnake.Embed(
|
embed = disnake.Embed(description=post["content"], color=disnake.Color.blue())
|
||||||
description=post["content"],
|
|
||||||
color=disnake.Color.blue()
|
|
||||||
)
|
|
||||||
|
|
||||||
embed.set_author(
|
embed.set_author(
|
||||||
name=user.display_name if user.display_name else user.username,
|
name=user.display_name if user.display_name else user.username,
|
||||||
url=f"https://soteria.social/{user.id}",
|
url=f"https://soteria.social/{user.id}",
|
||||||
icon_url=soteria.Asset(client = sot, asset_id = user.avatar).url
|
icon_url=soteria.Asset(client=sot, asset_id=user.avatar).url,
|
||||||
)
|
)
|
||||||
|
|
||||||
embed_list.append(embed)
|
embed_list.append(embed)
|
||||||
|
|
||||||
await inter.edit_original_response(embeds=embed_list)
|
await inter.edit_original_response(embeds=embed_list)
|
||||||
|
|
||||||
setup, teardown = plugin.create_extension_handlers()
|
|
||||||
|
setup, teardown = plugin.create_extension_handlers()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue