
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
This API can be used to interface with the Server Monitoring Discord Bot only if the API is enabled on it. For this, the bot needs to run on the same PC, or the API needs to be set up to allow outside connections.
To create an api, import the package, and use the required arguments.
import smdb_api
API = smdb_api.API("Test", "80716cbfd9f90428cd308acc193b4b58519a4f10a7440b97aaffecf75e63ecec")
Avaleable arguments:
To initiate the connection, use the validate command. The validate function can get a timeout limit, so it won't hault the program, if the api server won't ansvear within a set time.
API.validate()
server_status = API.get_status()
To add a command to the bot, use the 'create_function' command, like shown here:
[...]
def my_callback(message):
#Does something
API.create_function("MyScript", "Some text to help\nUsage: &MyScript <User input>\nCategory: SERVER", my_callback)
To send a message to someone, use the 'send_message' command:
[...]
discordId="##################"
API.send_message("Test message to a channel", discordId)
print(f"I sent a message to {API.get_username(discordId)}!")
Closing the connection safely is easy with the 'close' command.
[...]
API.close("Some reason for the bot logger.")
This function connects to the API server and validates itself with it. If the validation was successful, it starts a listener thread.
This function retrieves the bot's status and returns it in a dictionary.
This command returns the given Discord ID's username.
Determines if a user is admin in the bot's database.
This command allows you to send messages in the bot's name to selected users/channels or the default channel.
This command creates a function in the bot that can be called by a user.
This command connects the client to the user's voice channel
This command disconnects the client from the user's voice channel
Starts the audio file on the path provided. If the file is not supported error is returned.
Adds the audio file to the play list on the path provided. If the file is not supported error is returned.
Pauses the currently playing track.
Resumes playing the paused track.
Skips the current track if other tracks are in the play list.
Stops the currently playing track.
Lists the names of the items in the playlist, starting with the currently playing file.
Sets the callback for when the current tack finished playing for possible file removal. Returns the title of the finished track in a message object.
Subscribes a callback to an event. Returns a string that represents the string value of the previous state, string that represents the string value of the new state, and a message object containing the dm channel for the user with the discord interface.
FAQs
API package for Server Monitoring Discord Bot
We found that smdb-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.