The official Amino.NET Framework made for chatbots!
Making chatbots on Amino has always been quite a hassle, with the Amino.NET.Interactions framework this has never been easier!
- This C# library is based on Amino.NET and will therefore include it as a dependency, in case anything on this Library breaks consider updating Amino.NET to the latest stable (or dev) version, if this does not fix your issue, open an issue on github and or join our community Discord Server
- If you find a bug or have an idea you'd like to see in this project, please open an issue for it or join our community discord, alternatively you can always make a pull request if you'd like to contribute to the development of it
- Sometimes the documentation is not always up to date, we are aware of it and will fix it over time
- Amino.NET Group / Amino Scripting group and its sub parts do not take any responsibility for any harm being done using this framework, as it is free and open source, therefore we can not prevent any harm done.
- This is a non-profit project, however if you do want to us and our work you can check the Sponsor options of this repository, alternatively you can check out our Ko-Fi!
By using this library you agree that you are aware of the fact that you are breaking the App services Terms of Service - as Team Amino strictly forbids the use of any sort of third party software / scripting to gain an advantage over other members, any activity by third party tools found by Team Amino may result in your account getting banned from their services!
You can install Amino.NET.Interactions on NuGet and in any NuGet package manager of your choice!
Because Amino.NET.Interactions is a framework built on top of Amino.NET you first need to initialize your Amino Client
Amino.Client client = new Amino.Client(); // Note that you should fill in possible parameters if you want
client.login("email", "password"); // You need to be logged into your Amino Account (or the account you plan to use as a bot) make sure to NOT disable your websocket as it will be needed
The InteractionsClient can be found in the Amino.Interactions namespace and needs an Amino.Client to be constructed
InteractionsClient interactionClient = new InteractionsClient(client);
// Our InteractionsClient has a few values we could set, but we will leave it on default for now
With Amino.NET.Interactions you can easily create Command Modules, in short: Every class that is public and inherits InteractionBase is valid to be registered
public class MyCommandClass : InteractionBase { ... } // This module is valid because it is both public and inherits InteractionBase
Amino.NET.Interactions has a few Attributes you can use for your commands, they are stored in the Amino.Interactions.Attributes namespace, in this case we will use Async Tasks to get our command done, all commands should be stored inside of a valid module
[Command("ping", "Simple Ping Command")]
public async Task PingCommand(Interaction context)
{
await Respond(context, "pong");
}
In order for your commands to take effect and be usable, you must first register your modules, you have 2 options for it, register them all or register specific ones
interactionClient.RegisterModule<MyCommandClass>(); // This will register the MyCommandClass as it is a valid module
interactionClient.RegisterModules(Assembly.GetEntryAssemlbly()); // This will register all valid modules of the project, note that it will always need an Assembly object to be constructed, just pass in the EntryAssembly as shown in the example
In order for your Interactions to be received, you must first subscribe to an event on the InteractionsClient
, once that is done, Amino.NET.Interactions will automatically redirect incoming interactions into the corresponding functions.
interactionClient.InteractionCreated += (ctx) => {
interactionClient.HandleInteraction(ctx); // Note that you could also just build a function instead of catching the event like this
};
Amino.NET.Interactions has a few rules to keep in mind, these are:
- In order for a module to be valid it must be public and inherit InteractionBase
- Every Command function must have a parameter of type Interaction as its first parameter, this object will be used for our interaction Context, it is located in the Amino.Interactions.Objects namespace
- For command parameters you currenly only have 2 options, String and String[], a
string
will contain a single word whilestring[]
assume that you want to collect the rest of the message, which is why it is advised to be the last parameter, if you choose to collect all remaining words using astring[]
parameter, you can find them inindex 0
of the array - Commands can not contain spaces, consider using
-
or_