Java Discord Bot Tutorial - Ep 10: Ban Command

preview_player
Показать описание
This is the tenth episode of the java discord bot tutorial. In this episode we will be looking at how to make a ban command for your bot

Code for this tutorial:

Subscribe:
Рекомендации по теме
Комментарии
Автор

Hello relaxing leg, I have a doubt regarding Listeners and commands. I have a listener named SpamDetector which basically detects spam messages and gives timeout to the user, What I want to do is that create a command ( using ICommand interface ) that will enable this listener and disable this listener, like a toggle command. But I don't know how i can achieve that, there aren't any tutorials on something like this and I am really bad at reading the docs,

Can you please explain me how I can achieve a feature like this and probably give an example too for better understanding.

Thank you for helping me with my previous doubts because of you I was able to make a good discord bot for my server

DrEggCake
Автор

Hello, do you know how to make bot online when I turn off my pc?

d_a_r_ii
Автор

Hi relaxing leg, this has changed, the reason now needs to be chained with the ban().reason() I have a doubt in this,
According to jda wiki the format is guild.ban(user, 7, TimeUnit.DAYS).reason("the reason").queue()

Can you make me understand the meaning of TimeUnit, I don't understand why the integer comes in between and then time unit is after that

Edit: I think i am wrong with the format, when i use banned.ban(user, duration, TimeUnit.DAYS) it is showing that duration is int and i need TimeUnit when i ctrl + click the ban() it shows this
default AuditableRestAction<Void> ban(int deletionTimeframe, @Nonnull TimeUnit unit)
{
return getGuild().ban(this, deletionTimeframe, unit);
}

I am sorry but I don't understand how this works and what this means, It would be really helpful if you could make me understand why the format is different in two places or I am understanding it wrong

DrEggCake