maxenger 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
maxenger-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 maxexiyo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: maxenger
3
+ Version: 0.2.0
4
+ Summary: Librería para hacer bots de Maxenger
5
+ Author: Maxexiyo
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://maxenger.dpdns.org
8
+ Keywords: maxenger,bot,chat,async
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Framework :: AsyncIO
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Developers
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: python-socketio[asyncio_client]>=5.10
17
+ Requires-Dist: aiohttp>=3.9
18
+ Dynamic: license-file
19
+
20
+ # maxenger
21
+
22
+ Librería de Python para hacer bots de Maxenger.
23
+
24
+ ```bash
25
+ pip install -e . # desde esta carpeta (después: pip install maxenger)
26
+ ```
27
+
28
+ ## Tu primer bot
29
+
30
+ 1. En Maxenger crea un bot (panel de bots) y copia su token (`mxb_...`). Solo se muestra una vez.
31
+ 2. Invítalo a tu fiesta con el enlace de invitación del bot.
32
+ 3. Escribe esto y córrelo:
33
+
34
+ ```python
35
+ from maxenger import Embed, commands
36
+
37
+ bot = commands.Bot("mxb_TU_TOKEN", "https://maxenger.dpdns.org")
38
+
39
+ @bot.command(description="Suma dos números")
40
+ async def suma(ctx, a: int, b: int = 0):
41
+ await ctx.reply(f"{a} + {b} = {a + b}")
42
+
43
+ @bot.command(description="Repite lo que escribas")
44
+ async def eco(ctx, *, texto):
45
+ await ctx.send(embed=Embed(title="Eco", description=texto, color=0x5865F2))
46
+
47
+ @bot.event
48
+ async def on_ready():
49
+ print("Bot conectado. Prefijo:", bot.prefix)
50
+
51
+ bot.run()
52
+ ```
53
+
54
+ En el chat se usa con el prefijo de tu bot: `!tubot suma 2 3`. Los comandos también salen en el autocompletado.
55
+
56
+ ## Piezas
57
+
58
+ | Pieza | Para qué |
59
+ |---|---|
60
+ | `commands.Bot(token, url)` | El bot: conexión, comandos y eventos |
61
+ | `@bot.command(name=, description=, aliases=)` | Registra un comando; los argumentos se convierten por su tipo (`int`, `float`, `bool`, `str`) |
62
+ | `*, texto` | Un argumento "keyword-only" recibe el resto del texto |
63
+ | `commands.Cog` | Agrupa comandos y eventos en una clase (`await bot.add_cog(MiCog())`) |
64
+ | `@bot.event` / `@Cog.listener()` | Eventos: `on_ready`, `on_message`, `on_disconnect`, `on_command_error`, `on_command_not_found` |
65
+ | `ctx.send / ctx.reply / ctx.typing()` | Responder en el canal |
66
+ | `Embed` | Tarjetas con título, campos, imagen, pie, color |
67
+ | `ui.View`, `@ui.button`, `@ui.select` | Botones y menús (`await ctx.send(view=MiVista())`) |
68
+ | `interaction.respond(...)` | Respuesta privada que solo ve quien hizo clic |
69
+ | `ui.Modal` + `ui.TextInput` | Formularios (`await interaction.send_modal(modal)`) |
70
+ | `message.edit / delete / react / fetch_reactors` | Acciones sobre mensajes |
71
+ | `canal.history(limit)` / `canal.fetch_message(id)` | Leer mensajes anteriores |
72
+ | `File(ruta_o_bytes, spoiler=)` | Mandar archivos: `ctx.send("mira", file=File("foto.png"))` (hasta 10) |
73
+ | `await bot.get_party(id)` | Miembros, roles, canales y permisos de la fiesta |
74
+ | `fiesta.kick / ban / unban / set_roles / set_nickname / create_channel` | Moderación (con los permisos del rol del bot) |
75
+ | `Permissions`, `miembro.permissions` | Permisos de cada persona |
76
+ | `await bot.set_activity("algo")` | «Jugando a …» en el perfil del bot |
77
+ | `await bot.wait_for("message", check=..., timeout=)` | Esperar una respuesta |
78
+ | `tasks.loop(seconds=)` | Tareas que se repiten |
79
+
80
+ ### Botones
81
+
82
+ ```python
83
+ from maxenger import ui
84
+
85
+ class Confirmar(ui.View):
86
+ @ui.button(label="Sí", style="success")
87
+ async def si(self, interaction, boton):
88
+ await interaction.respond("¡Hecho!")
89
+
90
+ @ui.button(label="No", style="danger")
91
+ async def no(self, interaction, boton):
92
+ await interaction.edit_message(content="Cancelado", view=ui.View())
93
+
94
+ @bot.command()
95
+ async def borrar(ctx):
96
+ await ctx.send("¿Seguro?", view=Confirmar())
97
+ ```
98
+
99
+ ### Cog
100
+
101
+ ```python
102
+ class Utiles(commands.Cog):
103
+ @commands.command(description="Responde pong")
104
+ async def ping(self, ctx):
105
+ await ctx.reply("pong")
106
+
107
+ @commands.Cog.listener()
108
+ async def on_message(self, mensaje):
109
+ ...
110
+
111
+ # dentro de una función async, o con asyncio.run:
112
+ await bot.add_cog(Utiles())
113
+ ```
114
+
115
+ ## Verificaciones, cooldowns, grupos y ayuda
116
+
117
+ ```python
118
+ @bot.command()
119
+ @commands.has_permissions(kick_members=True) # quien lo use necesita ese permiso
120
+ @commands.bot_has_permissions(kick_members=True) # y el bot también
121
+ @commands.cooldown(1, 30) # 1 uso cada 30 s por persona (type="channel" o "party" también)
122
+ async def echar(ctx, quien: commands.Member, *, motivo="sin motivo"):
123
+ await ctx.party.kick(quien)
124
+
125
+ @bot.group()
126
+ async def config(ctx): ...
127
+
128
+ @config.command()
129
+ async def ver(ctx, clave): ... # !tubot config ver clave
130
+ ```
131
+
132
+ - Argumentos con tipo `commands.Member`, `commands.User` o `commands.Role` aceptan menciones o ids.
133
+ - Otras verificaciones: `@commands.check(funcion)`, `@commands.is_party_owner()` y `@bot.check` (global).
134
+ - Hay un comando `ayuda` automático (apágalo con `Bot(..., help_command=False)`).
135
+ - Errores: define `on_command_error(ctx, error)` o deja los mensajes por defecto.
136
+
137
+ ## Eventos
138
+
139
+ `on_ready`, `on_message`, `on_message_edit(mensaje)`, `on_message_delete(canal, id)`, `on_reaction_add(reaccion, usuario)`, `on_reaction_remove`, `on_member_join(fiesta, usuario)`, `on_member_remove(fiesta, usuario, motivo)` (motivo: `leave`, `kick` o `ban`), `on_command`, `on_command_completion`, `on_command_error`, `on_command_not_found`, `on_disconnect`.
140
+
141
+ ## ¿Prefieres no mantener una conexión abierta?
142
+
143
+ Mira `API.md`: también hay API REST y webhooks.
144
+
145
+ ## Límites
146
+
147
+ - Los bots solo ven mensajes de los canales de las fiestas donde están (nunca chats directos) y no ven mensajes de otros bots.
148
+ - Esta versión no incluye llamadas de voz ni mensajes directos de bots.
@@ -0,0 +1,129 @@
1
+ # maxenger
2
+
3
+ Librería de Python para hacer bots de Maxenger.
4
+
5
+ ```bash
6
+ pip install -e . # desde esta carpeta (después: pip install maxenger)
7
+ ```
8
+
9
+ ## Tu primer bot
10
+
11
+ 1. En Maxenger crea un bot (panel de bots) y copia su token (`mxb_...`). Solo se muestra una vez.
12
+ 2. Invítalo a tu fiesta con el enlace de invitación del bot.
13
+ 3. Escribe esto y córrelo:
14
+
15
+ ```python
16
+ from maxenger import Embed, commands
17
+
18
+ bot = commands.Bot("mxb_TU_TOKEN", "https://maxenger.dpdns.org")
19
+
20
+ @bot.command(description="Suma dos números")
21
+ async def suma(ctx, a: int, b: int = 0):
22
+ await ctx.reply(f"{a} + {b} = {a + b}")
23
+
24
+ @bot.command(description="Repite lo que escribas")
25
+ async def eco(ctx, *, texto):
26
+ await ctx.send(embed=Embed(title="Eco", description=texto, color=0x5865F2))
27
+
28
+ @bot.event
29
+ async def on_ready():
30
+ print("Bot conectado. Prefijo:", bot.prefix)
31
+
32
+ bot.run()
33
+ ```
34
+
35
+ En el chat se usa con el prefijo de tu bot: `!tubot suma 2 3`. Los comandos también salen en el autocompletado.
36
+
37
+ ## Piezas
38
+
39
+ | Pieza | Para qué |
40
+ |---|---|
41
+ | `commands.Bot(token, url)` | El bot: conexión, comandos y eventos |
42
+ | `@bot.command(name=, description=, aliases=)` | Registra un comando; los argumentos se convierten por su tipo (`int`, `float`, `bool`, `str`) |
43
+ | `*, texto` | Un argumento "keyword-only" recibe el resto del texto |
44
+ | `commands.Cog` | Agrupa comandos y eventos en una clase (`await bot.add_cog(MiCog())`) |
45
+ | `@bot.event` / `@Cog.listener()` | Eventos: `on_ready`, `on_message`, `on_disconnect`, `on_command_error`, `on_command_not_found` |
46
+ | `ctx.send / ctx.reply / ctx.typing()` | Responder en el canal |
47
+ | `Embed` | Tarjetas con título, campos, imagen, pie, color |
48
+ | `ui.View`, `@ui.button`, `@ui.select` | Botones y menús (`await ctx.send(view=MiVista())`) |
49
+ | `interaction.respond(...)` | Respuesta privada que solo ve quien hizo clic |
50
+ | `ui.Modal` + `ui.TextInput` | Formularios (`await interaction.send_modal(modal)`) |
51
+ | `message.edit / delete / react / fetch_reactors` | Acciones sobre mensajes |
52
+ | `canal.history(limit)` / `canal.fetch_message(id)` | Leer mensajes anteriores |
53
+ | `File(ruta_o_bytes, spoiler=)` | Mandar archivos: `ctx.send("mira", file=File("foto.png"))` (hasta 10) |
54
+ | `await bot.get_party(id)` | Miembros, roles, canales y permisos de la fiesta |
55
+ | `fiesta.kick / ban / unban / set_roles / set_nickname / create_channel` | Moderación (con los permisos del rol del bot) |
56
+ | `Permissions`, `miembro.permissions` | Permisos de cada persona |
57
+ | `await bot.set_activity("algo")` | «Jugando a …» en el perfil del bot |
58
+ | `await bot.wait_for("message", check=..., timeout=)` | Esperar una respuesta |
59
+ | `tasks.loop(seconds=)` | Tareas que se repiten |
60
+
61
+ ### Botones
62
+
63
+ ```python
64
+ from maxenger import ui
65
+
66
+ class Confirmar(ui.View):
67
+ @ui.button(label="Sí", style="success")
68
+ async def si(self, interaction, boton):
69
+ await interaction.respond("¡Hecho!")
70
+
71
+ @ui.button(label="No", style="danger")
72
+ async def no(self, interaction, boton):
73
+ await interaction.edit_message(content="Cancelado", view=ui.View())
74
+
75
+ @bot.command()
76
+ async def borrar(ctx):
77
+ await ctx.send("¿Seguro?", view=Confirmar())
78
+ ```
79
+
80
+ ### Cog
81
+
82
+ ```python
83
+ class Utiles(commands.Cog):
84
+ @commands.command(description="Responde pong")
85
+ async def ping(self, ctx):
86
+ await ctx.reply("pong")
87
+
88
+ @commands.Cog.listener()
89
+ async def on_message(self, mensaje):
90
+ ...
91
+
92
+ # dentro de una función async, o con asyncio.run:
93
+ await bot.add_cog(Utiles())
94
+ ```
95
+
96
+ ## Verificaciones, cooldowns, grupos y ayuda
97
+
98
+ ```python
99
+ @bot.command()
100
+ @commands.has_permissions(kick_members=True) # quien lo use necesita ese permiso
101
+ @commands.bot_has_permissions(kick_members=True) # y el bot también
102
+ @commands.cooldown(1, 30) # 1 uso cada 30 s por persona (type="channel" o "party" también)
103
+ async def echar(ctx, quien: commands.Member, *, motivo="sin motivo"):
104
+ await ctx.party.kick(quien)
105
+
106
+ @bot.group()
107
+ async def config(ctx): ...
108
+
109
+ @config.command()
110
+ async def ver(ctx, clave): ... # !tubot config ver clave
111
+ ```
112
+
113
+ - Argumentos con tipo `commands.Member`, `commands.User` o `commands.Role` aceptan menciones o ids.
114
+ - Otras verificaciones: `@commands.check(funcion)`, `@commands.is_party_owner()` y `@bot.check` (global).
115
+ - Hay un comando `ayuda` automático (apágalo con `Bot(..., help_command=False)`).
116
+ - Errores: define `on_command_error(ctx, error)` o deja los mensajes por defecto.
117
+
118
+ ## Eventos
119
+
120
+ `on_ready`, `on_message`, `on_message_edit(mensaje)`, `on_message_delete(canal, id)`, `on_reaction_add(reaccion, usuario)`, `on_reaction_remove`, `on_member_join(fiesta, usuario)`, `on_member_remove(fiesta, usuario, motivo)` (motivo: `leave`, `kick` o `ban`), `on_command`, `on_command_completion`, `on_command_error`, `on_command_not_found`, `on_disconnect`.
121
+
122
+ ## ¿Prefieres no mantener una conexión abierta?
123
+
124
+ Mira `API.md`: también hay API REST y webhooks.
125
+
126
+ ## Límites
127
+
128
+ - Los bots solo ven mensajes de los canales de las fiestas donde están (nunca chats directos) y no ven mensajes de otros bots.
129
+ - Esta versión no incluye llamadas de voz ni mensajes directos de bots.
@@ -0,0 +1,10 @@
1
+ """maxenger — librería para hacer bots de Maxenger."""
2
+ from .client import (Client, Channel, Message, User, Member, Role, Party, PartyInfo, Reaction, File,
3
+ Interaction, MaxengerError)
4
+ from .permissions import Permissions
5
+ from .embed import Embed
6
+ from . import ui, commands, tasks
7
+
8
+ __version__ = "0.2.0"
9
+ __all__ = ["Client", "Channel", "Message", "User", "Member", "Role", "Party", "PartyInfo", "Reaction", "File",
10
+ "Interaction", "MaxengerError", "Permissions", "Embed", "ui", "commands", "tasks"]