Python API wrapper for Nerimity originating from Fiiral, maintained by Deutscher775
For questions, help or anything else feel free to join the nerimity.py Nerimity server.
- Current Features
See the features that the framework currently supports. - Installation
Guide on how to install nerimity.py. - Example Bot
An example bot you can directly use. - Use-case-examples
Many various examples on how to use specific functions.
- Define and register commands using the @client.command decorator.
- Execute commands with parameters. Register event listeners using the @client.listen decorator. Handle various events such as:
- on_ready
- on_message_create
- on_message_updated
- on_message_deleted
- on_button_clicked
- on_presence_change
- on_reaction_add
- on_member_updated
- on_role_updated
- on_role_deleted
- on_role_created
- on_channel_updated
- on_channel_deleted
- on_channel_created
- on_server_updated
- on_member_join
- on_member_left
- on_server_joined
- on_server_left
- on_friend_request_sent
- on_friend_request_pending
- on_friend_request_accepted
- on_friend_removed
- on_minute_pulse
- on_hour_pulse
- Send messages to channels.
- add attachments
- add buttons with custom callback
- Edit and delete messages.
- React and unreact to messages.
- Create and upload attachments.
- Deserialize attachments from JSON.
- Update channel information.
- Send messages to channels.
- Get messages from channels.
- Purge messages from channels.
- Deserialize channels from JSON.
- Send messages, remove messages, and react to messages within a command context.
- Create and delete server invites.
- Deserialize invites from JSON.
- Follow, unfollow, add friend, remove friend, and send direct messages to members.
- Kick, ban, and unban server members.
- Deserialize members and server members from JSON.
- Create, delete, comment on, like, and unlike posts.
- Get comments on posts.
- Deserialize posts from JSON.
- Create, update, and delete roles.
- Deserialize roles from JSON.
- Get server details and ban list.
- Create, update, and delete channels and roles.
- Create and delete invites.
- Update server members.
- Deserialize servers from JSON.
- Change the presence status of the bot.
- Handle button interactions and send popups.
- Deserialize button interactions from JSON.
Currently there is no direct installation method. (WIP)
- Clone the repository
git clone https://github.com/deutscher775/nerimity.py.git
import nerimity
client = nerimity.Client(
token="YOUR_BOT_TOKEN",
prefix='!',
)
@client.command(name="ping")
async def ping(ctx: nerimity.Context, params: str):
await ctx.send("Pong!")
@client.listen("on_ready")
async def on_ready():
print(f"Logged in as {client.account.username}")
client.run()
@client.command(name="testattachment")
async def testattachment(ctx: nerimity.Context, params):
file = await nerimity.Attachment.construct("test.png").upload()
result = await ctx.send("Test", attachment=file)
@client.command(name="testbutton")
async def testbutton(ctx: nerimity.Context, params):
popup_button = nerimity.Button.construct(label="Popup!", id="popuptestbutton", alert=True)
async def popup_callback(buttoninteraction: nerimity.ButtonInteraction):
user = client.get_user(buttoninteraction.userId)
buttoninteraction.send_popup("Test", f"Hello, {user.username}!")
await popup_button.set_callback(popup_callback)
message_button = nerimity.Button.construct(label="Message!", id="messagetestbutton")
async def message_callback(buttoninteraction: nerimity.ButtonInteraction):
user = client.get_user(buttoninteraction.userId)
await ctx.send(f"Hello, {user.username}!")
await message_button.set_callback(message_callback)
await ctx.send("Test", buttons=[message_button, popup_button])
@client.command(name="createpost")
async def createpost(ctx: nerimity.Context, params):
content = ""
for param in params:
content += param + " "
await ctx.send("Creating post with text: " + content)
post = nerimity.Post.create_post(content)
print(post)
await ctx.send("Post created.")
@client.command(name="comment")
async def comment(ctx: nerimity.Context, params):
post_id = int(params[0])
content = ""
for param in params[1:]:
content += param + " "
post = nerimity.Post.get_post(post_id)
post.create_comment(content)
await ctx.send("Commented on post.")
@client.command(name="deletepost")
async def deletepost(ctx: nerimity.Context, params):
post_id = int(params[0])
post = nerimity.Post.get_post(post_id)
post.delete_post()
await ctx.send("Deleted post.")
If you encounter any issues while using the framework feel free to open an Issue.