remove space before all punctuation and add interrobang

This commit is contained in:
Lera Elvoé 2023-02-13 14:59:41 +03:00
parent 738c4efa3b
commit e56aac740b
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])/, '\1')}#{event.message.content}"
$sentence.clear
next
end