Merge pull request #2 from Suiranoil/dev
Pull dev into master because i messed up
This commit is contained in:
@@ -24,7 +24,7 @@ impl MixerCommand for CreatorCommand {
|
|||||||
fn create(&self, command: &mut CreateApplicationCommand) {
|
fn create(&self, command: &mut CreateApplicationCommand) {
|
||||||
command
|
command
|
||||||
.name(self.name())
|
.name(self.name())
|
||||||
.description("Hello world!")
|
.description("Some handful commands for the bot's creator!")
|
||||||
.create_option(|option| {
|
.create_option(|option| {
|
||||||
option
|
option
|
||||||
.name("verify")
|
.name("verify")
|
||||||
@@ -54,7 +54,7 @@ impl MixerCommand for CreatorCommand {
|
|||||||
|
|
||||||
if !has_permission {
|
if !has_permission {
|
||||||
interaction
|
interaction
|
||||||
.create_interaction_response(&ctx.http, |response| {
|
.create_interaction_response(ctx, |response| {
|
||||||
response
|
response
|
||||||
.kind(InteractionResponseType::ChannelMessageWithSource)
|
.kind(InteractionResponseType::ChannelMessageWithSource)
|
||||||
.interaction_response_data(|message| {
|
.interaction_response_data(|message| {
|
||||||
@@ -105,7 +105,7 @@ impl CreatorCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interaction
|
interaction
|
||||||
.create_interaction_response(&ctx.http, |response| {
|
.create_interaction_response(ctx, |response| {
|
||||||
response
|
response
|
||||||
.kind(InteractionResponseType::ChannelMessageWithSource)
|
.kind(InteractionResponseType::ChannelMessageWithSource)
|
||||||
.interaction_response_data(|message| {
|
.interaction_response_data(|message| {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ impl MixerCommand for RatingCommand {
|
|||||||
User(user, _) => user,
|
User(user, _) => user,
|
||||||
_ => {
|
_ => {
|
||||||
interaction
|
interaction
|
||||||
.create_interaction_response(&ctx.http, |response| {
|
.create_interaction_response(ctx, |response| {
|
||||||
response
|
response
|
||||||
.kind(InteractionResponseType::ChannelMessageWithSource)
|
.kind(InteractionResponseType::ChannelMessageWithSource)
|
||||||
.interaction_response_data(|message| {
|
.interaction_response_data(|message| {
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ pub struct MixerCommandHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MixerCommandHandler {
|
impl MixerCommandHandler {
|
||||||
pub fn new(commands: HashMap<String, Box<dyn MixerCommand>>) -> Self {
|
pub fn new() -> Self {
|
||||||
Self { commands }
|
Self {
|
||||||
|
commands: HashMap::new(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_command<T: MixerCommand + 'static>(&mut self, command: T) {
|
pub fn add_command<T: MixerCommand + 'static>(&mut self, command: T) {
|
||||||
@@ -49,7 +51,7 @@ impl MixerCommandHandler {
|
|||||||
interaction.user.name, interaction.user.id, interaction.data.name
|
interaction.user.name, interaction.user.id, interaction.data.name
|
||||||
);
|
);
|
||||||
interaction
|
interaction
|
||||||
.create_interaction_response(&ctx.http, |response| {
|
.create_interaction_response(ctx, |response| {
|
||||||
response
|
response
|
||||||
.kind(InteractionResponseType::ChannelMessageWithSource)
|
.kind(InteractionResponseType::ChannelMessageWithSource)
|
||||||
.interaction_response_data(|message| {
|
.interaction_response_data(|message| {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ pub struct MixerBot {
|
|||||||
impl MixerBot {
|
impl MixerBot {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
command_handler: MixerCommandHandler::new(HashMap::new()),
|
command_handler: MixerCommandHandler::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ impl EventHandler for MixerBot {
|
|||||||
}
|
}
|
||||||
Interaction::MessageComponent(component) => {
|
Interaction::MessageComponent(component) => {
|
||||||
component
|
component
|
||||||
.create_interaction_response(ctx.http(), |response| {
|
.create_interaction_response(ctx, |response| {
|
||||||
response.kind(InteractionResponseType::DeferredUpdateMessage)
|
response.kind(InteractionResponseType::DeferredUpdateMessage)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user