Fetch Skill User Data Dynamically
All Senpi user-related data is injected to the runtime's state through the Senpi Client and accessible globally from your Skill.
To fetch the user data, you can simply use the state
paramater from an action's handler
function.
For example, if you want to fetch the user's Senpi account information, you can use the moxieUserInfo
property from the state
object as shown below:
import {
type Action,
type IAgentRuntime,
type Memory,
type HandlerCallback,
type State,
} from "@moxie-protocol/core";
export const exampleAction: Action = {
handler: async (
runtime: IAgentRuntime,
message: Memory,
state: State,
_options: { [key: string]: unknown },
callback: HandlerCallback
) => {
const userData = state.moxieUserInfo;
return true;
},
};
There are other user-related data available in the state
object that you can use to fetch user data dynamically.
Learn more here to see all the available properties in the state
object to build your Skill.
Developer Support
If you have any questions or need help with other use cases, feel free to join the Senpi Telegram Developers Channel and ask your questions there.
Our team is always ready to help you with any questions you may have.