remove space before comma

This commit is contained in:
Lera Elvoé 2023-02-13 14:54:15 +03:00
parent 738c4efa3b
commit 153b1150a6
Signed by: yagich
SSH Key Fingerprint: SHA256:6xjGb6uA7lAVcULa7byPEN//rQ0wPoG+UzYVMfZnbvc

4
bot.rb
View File

@ -60,11 +60,11 @@ bot.reaction_remove do |event|
end
bot.message(in: Integer(ENV['SENTENCE_CHANNEL'])) do |event|
if ['?', '!', '.', '...'].include? event.message.content
if ['?', '!', '.', '...', '?!'].include? event.message.content
if $sentence.empty?
next
end
event << "Congratulations, your sentence is: #{$sentence.values.join(" ").gsub(/\s,/, ",")}#{event.message.content}"
event << "Congratulations, your sentence is: #{$sentence.values.join(" ").gsub(/\s([^\w\s])/, '\\\0')}#{event.message.content}"
$sentence.clear
next
end