Skip to content

Instantly share code, notes, and snippets.

@tuna2134
Last active March 30, 2024 12:26
Show Gist options
  • Save tuna2134/8b933793e2883270e1f1e8c43b526315 to your computer and use it in GitHub Desktop.
Save tuna2134/8b933793e2883270e1f1e8c43b526315 to your computer and use it in GitHub Desktop.
struct {};
#[view]
impl NewView {
#[button(name = "hello", style = ButtonStyle.green)]
async fn hello(&self, interaction: Interaction, button: Button) -> anyhow::Result<()> {
interaction.response.send_message("hello").await?;
Ok(())
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::new("token");
let view = NewView {};
client.create_message(Id::new(1234)).components(view.to_components()).await?;
Ok(()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment