First successful plugin setup
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
Name = "Auto Buddy"
|
||||||
|
Version = "1.0"
|
||||||
|
Authors = ["Prodigical"]
|
||||||
|
Description = "Automatically adds users to your buddy list when they post the trigger phrase in a target room."
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
from pynicotine.pluginsystem import BasePlugin
|
||||||
|
|
||||||
|
TARGET_ROOM = "SickGaming.net"
|
||||||
|
TRIGGER_PHRASE = "add me plz"
|
||||||
|
|
||||||
|
|
||||||
|
class Plugin(BasePlugin):
|
||||||
|
name = "Auto Buddy"
|
||||||
|
description = "Automatically adds users who ask to be added in SickGaming.net"
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
def server_connect_notification(self):
|
||||||
|
"""Join target room after connecting to Soulseek server."""
|
||||||
|
self.log("Connected. Joining room: %s", TARGET_ROOM)
|
||||||
|
self.core.chatrooms.show_room(TARGET_ROOM, switch_page=False)
|
||||||
|
|
||||||
|
def incoming_public_chat_notification(self, room, user, line):
|
||||||
|
"""Triggered whenever someone talks in a room."""
|
||||||
|
if room != TARGET_ROOM:
|
||||||
|
return
|
||||||
|
|
||||||
|
if user == self.core.users.login_username:
|
||||||
|
return
|
||||||
|
|
||||||
|
if TRIGGER_PHRASE in line.lower():
|
||||||
|
self.log("%s asked to be added. Adding to buddy list.", user)
|
||||||
|
self.core.buddies.add_buddy(user)
|
||||||
|
self.send_public(room, f"{user}: added.")
|
||||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
|||||||
|
Name = "Example Plugin"
|
||||||
|
Version = "1.0"
|
||||||
|
Authors = ["Prodigical"]
|
||||||
|
Description = "Minimal plugin used to validate plugin loading in this container."
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
from pynicotine.pluginsystem import BasePlugin
|
||||||
|
|
||||||
|
|
||||||
|
class Plugin(BasePlugin):
|
||||||
|
name = "Example Plugin"
|
||||||
|
description = "A minimal Nicotine+ plugin example. Logs when connected."
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
def loaded_notification(self):
|
||||||
|
self.log("Example Plugin loaded.")
|
||||||
Binary file not shown.
Reference in New Issue
Block a user