Skocz do zawartości
  • 0

Problem z botem discord


Kret

Pytanie

Hej mam problem z napisaniem prostej komendy do bota na napisanie hej poniewaz gdy pisze ja na czacie w konsoli wyskakuje cos takiego i czy mogl by mi ktos pomoc

(node:9540) DeprecationWarning: The message event is deprecated. Use messageCreate instead
(Use `node --trace-deprecation ...` to show where the warning was created)      

 

Mój Kod (jak cos to tam token jest ale go usunolem tera zeby tu wyslac):

const Discord = require ('discord.js')
 
const bot = new Discord.Client({
    intents: [
        Discord.Intents.FLAGS.GUILDS,
        Discord.Intents.FLAGS.GUILD_MESSAGES
    ]
});
 
bot.on('ready', () => {
    console.log('Bot online')
})
 
bot.on('message', (message) => {
    if(message.author.bot) return;
    if(message.channel.type !== 'text') return;
    let prefix = '!';
    // hello there ['hello', 'there']
    // !ban user reason ['user', 'reason']
    // hello
    let MessageArray = message.content.split(' ');
    let cmd = MessageArray[0].slice(prefix.length)
    let args = MessageArray.slice(1)
 
    if(!message.content.startsWitch(prefix)) return;
 
    if(cmd == 'hello') {
        message.channel.send('hello');
    }
 
})
 
bot.login("TOKEN")

 

Odnośnik do komentarza
https://skript.pl/temat/51667-problem-z-botem-discord/
Udostępnij na innych stronach

3 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
Godzinę temu, Kret napisał:

Hej mam problem z napisaniem prostej komendy do bota na napisanie hej poniewaz gdy pisze ja na czacie w konsoli wyskakuje cos takiego i czy mogl by mi ktos pomoc

(node:9540) DeprecationWarning: The message event is deprecated. Use messageCreate instead
(Use `node --trace-deprecation ...` to show where the warning was created)      

 

Mój Kod (jak cos to tam token jest ale go usunolem tera zeby tu wyslac):

const Discord = require ('discord.js')
 
const bot = new Discord.Client({
    intents: [
        Discord.Intents.FLAGS.GUILDS,
        Discord.Intents.FLAGS.GUILD_MESSAGES
    ]
});
 
bot.on('ready', () => {
    console.log('Bot online')
})
 
bot.on('message', (message) => {
    if(message.author.bot) return;
    if(message.channel.type !== 'text') return;
    let prefix = '!';
    // hello there ['hello', 'there']
    // !ban user reason ['user', 'reason']
    // hello
    let MessageArray = message.content.split(' ');
    let cmd = MessageArray[0].slice(prefix.length)
    let args = MessageArray.slice(1)
 
    if(!message.content.startsWitch(prefix)) return;
 
    if(cmd == 'hello') {
        message.channel.send('hello');
    }
 
})
 
bot.login("TOKEN")

 

Nie powinno to robić problemu, robisz po prostu bot.on('messageCreate', (message) => {

Odnośnik do komentarza
https://skript.pl/temat/51667-problem-z-botem-discord/#findComment-317253
Udostępnij na innych stronach

  • 0
32 minuty temu, maxcom1 napisał:

Nie powinno to robić problemu, robisz po prostu bot.on('messageCreate', (message) => {

zrobilem i tera wyskakuje cos takiego 

  1. (node:2152) DeprecationWarning: The message event is deprecated. Use messageCreate instead (Use node --trace-deprecation ... to show where the warning was created)
Odnośnik do komentarza
https://skript.pl/temat/51667-problem-z-botem-discord/#findComment-317259
Udostępnij na innych stronach

  • 0
26 minut temu, Kret napisał:

zrobilem i tera wyskakuje cos takiego 

  1. (node:2152) DeprecationWarning: The message event is deprecated. Use messageCreate instead (Use node --trace-deprecation ... to show where the warning was created)

Powinno być ok, tak jak w poleceniu dopisz --trace-deprecation

Odnośnik do komentarza
https://skript.pl/temat/51667-problem-z-botem-discord/#findComment-317261
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...