forked from mud/bankerbot-rb
Compare commits
13 Commits
feat/fuck-
...
feat/GIVE-
Author | SHA1 | Date | |
---|---|---|---|
c87a54932a
|
|||
702f0ca119 | |||
29bca2cafc | |||
f188c90284 | |||
ccc19b384e | |||
5e98f7353b | |||
6e492fc296 | |||
0c94e60258 | |||
cc0c60a82b | |||
66e6c3f688 | |||
d61f9543fb
|
|||
a9a313aa02 | |||
56f54bed6a |
43
coin.rb
43
coin.rb
@ -3,9 +3,18 @@ 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_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
|
||||||
|
|
||||||
@ -57,7 +66,6 @@ def clean_name(input)
|
|||||||
end
|
end
|
||||||
|
|
||||||
bot.message(in: Integer(ENV['BOT_CHANNEL'])) do |event|
|
bot.message(in: Integer(ENV['BOT_CHANNEL'])) do |event|
|
||||||
puts event.message
|
|
||||||
if event.message.attachments.count { |x| x.filename.scan(/coin*/).length > 0 } > 0
|
if event.message.attachments.count { |x| x.filename.scan(/coin*/).length > 0 } > 0
|
||||||
event.respond "Oh no! Looks like you tried to post a fradulent coin! #{clean_name event.author.display_name}, your coin balance has now been emptied. Let that be a lesson for next time!"
|
event.respond "Oh no! Looks like you tried to post a fradulent coin! #{clean_name event.author.display_name}, your coin balance has now been emptied. Let that be a lesson for next time!"
|
||||||
empty_coin(event.author.id)
|
empty_coin(event.author.id)
|
||||||
@ -65,7 +73,6 @@ bot.message(in: Integer(ENV['BOT_CHANNEL'])) do |event|
|
|||||||
end
|
end
|
||||||
|
|
||||||
bot.message(content: 'GET COIN' ) do |event|
|
bot.message(content: 'GET COIN' ) do |event|
|
||||||
next if event.author.role? 'robot friend'
|
|
||||||
# update score
|
# update score
|
||||||
if coin_state_active
|
if coin_state_active
|
||||||
if event.author.bot_account?
|
if event.author.bot_account?
|
||||||
@ -90,6 +97,34 @@ 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(with_text: '!leave') do |event|
|
||||||
|
event.respond PASTA
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
bot.run(true)
|
bot.run(true)
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
@ -104,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
|
||||||
|
Reference in New Issue
Block a user