Merge pull request #2 from Suiranoil/dev

Pull dev into master because i messed up
This commit is contained in:
Suiranoil
2023-04-26 11:50:24 +03:00
committed by GitHub
4 changed files with 11 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ impl MixerCommand for CreatorCommand {
fn create(&self, command: &mut CreateApplicationCommand) {
command
.name(self.name())
.description("Hello world!")
.description("Some handful commands for the bot's creator!")
.create_option(|option| {
option
.name("verify")
@@ -54,7 +54,7 @@ impl MixerCommand for CreatorCommand {
if !has_permission {
interaction
.create_interaction_response(&ctx.http, |response| {
.create_interaction_response(ctx, |response| {
response
.kind(InteractionResponseType::ChannelMessageWithSource)
.interaction_response_data(|message| {
@@ -105,7 +105,7 @@ impl CreatorCommand {
}
interaction
.create_interaction_response(&ctx.http, |response| {
.create_interaction_response(ctx, |response| {
response
.kind(InteractionResponseType::ChannelMessageWithSource)
.interaction_response_data(|message| {

View File

@@ -83,7 +83,7 @@ impl MixerCommand for RatingCommand {
User(user, _) => user,
_ => {
interaction
.create_interaction_response(&ctx.http, |response| {
.create_interaction_response(ctx, |response| {
response
.kind(InteractionResponseType::ChannelMessageWithSource)
.interaction_response_data(|message| {

View File

@@ -12,8 +12,10 @@ pub struct MixerCommandHandler {
}
impl MixerCommandHandler {
pub fn new(commands: HashMap<String, Box<dyn MixerCommand>>) -> Self {
Self { commands }
pub fn new() -> Self {
Self {
commands: HashMap::new(),
}
}
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
.create_interaction_response(&ctx.http, |response| {
.create_interaction_response(ctx, |response| {
response
.kind(InteractionResponseType::ChannelMessageWithSource)
.interaction_response_data(|message| {

View File

@@ -25,7 +25,7 @@ pub struct MixerBot {
impl MixerBot {
pub fn new() -> Self {
Self {
command_handler: MixerCommandHandler::new(HashMap::new()),
command_handler: MixerCommandHandler::new(),
}
}
@@ -121,7 +121,7 @@ impl EventHandler for MixerBot {
}
Interaction::MessageComponent(component) => {
component
.create_interaction_response(ctx.http(), |response| {
.create_interaction_response(ctx, |response| {
response.kind(InteractionResponseType::DeferredUpdateMessage)
})
.await