-
Notifications
You must be signed in to change notification settings - Fork 1
Wiadomość na wzmiankę @everyone #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,29 @@ client.on('ready', () => { | |
} | ||
}); | ||
}); | ||
client.on('message', message => { //Ten event wykonuje się, gdy bot wykryje wiadomość | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tak ogólnie, to przeniósłbym ciało tego event handlera do osobnej nazwanej funkcji, np. |
||
const pingEmbed = new Discord.MessageEmbed() | ||
.setColor('#eb1540') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrzuciłbym wartość koloru do zmiennej/stałej i jej tu użył. Być może w przyszłości będą w różnych miejscach używane jakieś kolory i wtedy przyda się mieć jedno miejsce, gdzie są one zadeklarowane i nazwane, wtedy łatwiej i wygodniej będzie tego używać. |
||
.setTitle('Nie wołaj wszystkich!') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Na tłumaczenia jest plik |
||
.setThumbnail('https://cdn.discordapp.com/attachments/617673807213232128/852887484542615572/Pingsock.png') | ||
awaluk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.setDescription('\nRozumiemy, że potrzebujesz pomocy, ale nie wszyscy chcą zostać o tym powiadomieni.\n Jest nas tutaj dużo i nie ma sensu, aby każdy dostał bezpośrednio taką informację.\n Nie trudno sobie wyobrazić jak irytujące byłoby, gdyby każdy wołał wszystkich do każdego tematu.\n Dlatego zadaj pytanie i po prostu poczekaj - jeśli ktoś będzie wiedział i mógł, to na pewno spróbuje odpowiedzieć.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. J.w. odnośnie tekstu tłumaczenia. |
||
|
||
if (message.content.includes("@everyone")) { //Jeśli wiadomość zawiera @everyone.. | ||
awaluk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
try{ | ||
if(!message.member.hasPermission('MENTION_EVERYONE')) //Sprawdzamy, czy wysyłający ma uprawnienia do wzmianki @everyone, jeśli nie to bot wysyła wiadomość | ||
message.author.send(pingEmbed) | ||
}catch{ | ||
console.log(message.author.username + " wysłał ping w wiadomości prywatnej do bota, hmm..") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Co ma w zasadzie robić ten catch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zapomniałem usunąć 😅
awaluk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
} else { | ||
if(message.content.includes("@here")) //Jeśli wiadomość zawiera @here.. | ||
try{ | ||
if(!message.member.hasPermission('MENTION_EVERYONE')) //Sprawdzamy, czy wysyłający ma uprawnienia do wzmianki @everyone, jeśli nie to bot wysyła wiadomość | ||
message.author.send(pingEmbed) | ||
}catch{ | ||
console.log(message.author.username + " wysłał ping w wiadomości prywatnej do bota, hmm..") | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zbędna ifologia. Zamiast tego lepsze by było coś w rodzaju:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha, dzięki wielkie, zapomniałem o "||" w javascriptcie, potem naprawię |
||
}); | ||
client.login(process.env.TOKEN); |
Uh oh!
There was an error while loading. Please reload this page.