Compare commits

...

10 Commits

Author SHA1 Message Date
f3d2ba62f0
give coin with react 2023-01-26 19:00:58 +03:00
702f0ca119 Update 'coin.rb' 2022-12-23 17:36:36 +00:00
29bca2cafc Update 'coin.rb' 2022-12-23 11:39:26 +00:00
f188c90284 Update 'coin.rb' 2022-11-12 08:09:09 +00:00
ccc19b384e Update 'coin.rb' 2022-11-11 09:37:10 +00:00
5e98f7353b Update 'coin.rb' 2022-11-09 21:12:08 +00:00
6e492fc296 Update 'coin.rb' 2022-11-09 14:12:41 +00:00
0c94e60258 Update 'coin.rb' 2022-11-09 08:10:20 +00:00
cc0c60a82b increase max coins per day 2022-11-09 07:59:08 +00:00
66e6c3f688 narrow down midnight sleep time 2022-11-09 07:58:17 +00:00

39
coin.rb
View File

@ -3,11 +3,17 @@ require 'yaml'
require 'discordrb' require 'discordrb'
MAX_COINS_PER_DAY = 3 MAX_COINS_PER_DAY = 4
COIN_TIMEOUT = 15 COIN_TIMEOUT = 15
SCOREBOARD = './scoreboard.yml' SCOREBOARD = './scoreboard.yml'
<<<<<<< HEAD
PASTA='You know what? Im done, i am leaving, we were friendly talking about the subject. This crossed the line of "ok killer of joy" to "no fun allowed"'
=======
DUMBASS = 521596582962003968 DUMBASS = 521596582962003968
DUMBASS_BOT = 1034966228755820575 DUMBASS_BOT = 1034966228755820575
COIN_EMOJI = '🪙'
>>>>>>> b24afe7 (give coin with react)
coin_state_active = false coin_state_active = false
coins_offered_today = 0 coins_offered_today = 0
@ -91,11 +97,32 @@ bot.message(with_text: '/coins') do |event|
event.respond "#{clean_name event.author.display_name}, you have #{plural('coin', coins)}!" event.respond "#{clean_name event.author.display_name}, you have #{plural('coin', coins)}!"
end end
bot.message(from: DUMBASS_BOT) do |event| bot.message(with_text: '!leave') do |event|
next unless event.message.content.scan(/(?=no swearing)/).count > 0 event.respond PASTA
coins = increment_coin(DUMBASS, -1) end
event.respond "<@#{DUMBASS}>, you have been penalized 1 coin for the grossly negligent behavior of your Intellectual Offspring! You now have #{plural('coin', coins)}."
bot.message(with_text: '!cum', in: Integer(ENV['CUM_CHANNEL'])) do |event|
next if not ENV['CUM_CHANNEL']
event.respond "OHHHHHH IM GONNA CUM"
end
bot.reaction_add do |event|
next unless event.emoji.name == COIN_EMOJI
reactor_coins = get_coin_count(event.user.id)
if reactor_coins == 0
event.respond("<@#{event.user.id}>, you're a poor shmuck!")
next
end
if event.message.author == event.user
event.respond("<@#{event.user.id}>, you can't give coins to yourself!")
next
end
increment_coin(event.message.author.id)
increment_coin(event.user.id, -1)
event.respond "<@#{event.message.author.id}>, you have been given a coin by <@#{event.user.id}>!"
end end
bot.run(true) bot.run(true)
@ -112,7 +139,7 @@ loop do
# if max coins per day has reached, sleep until midnight # if max coins per day has reached, sleep until midnight
if coins_offered_today >= MAX_COINS_PER_DAY if coins_offered_today >= MAX_COINS_PER_DAY
sleep(get_seconds_to_midnight(Time.now)) sleep(get_seconds_to_midnight(Time.now))
sleep(get_random_hours(0, 11)) sleep(get_random_hours(5, 11))
coins_offered_today = 0 coins_offered_today = 0
end end
end end