Removed server intent, removed welcoming message.
This commit is contained in:
38
src/bot.rb
38
src/bot.rb
@@ -23,7 +23,7 @@ class CheeseBot
|
|||||||
puts "Initializing bot..."
|
puts "Initializing bot..."
|
||||||
@bot = Discordrb::Bot.new(
|
@bot = Discordrb::Bot.new(
|
||||||
token: ENV['BOT_TOKEN'],
|
token: ENV['BOT_TOKEN'],
|
||||||
intents: [:servers, :server_messages],
|
intents: [:server_messages],
|
||||||
)
|
)
|
||||||
|
|
||||||
puts "Registering the Message Checker..."
|
puts "Registering the Message Checker..."
|
||||||
@@ -68,41 +68,5 @@ class CheeseBot
|
|||||||
puts "#{@bot.profile.username} is online... GIVE ME THE CHEESE."
|
puts "#{@bot.profile.username} is online... GIVE ME THE CHEESE."
|
||||||
@bot.update_status("online", "We're so back.", nil, 0, false, 0)
|
@bot.update_status("online", "We're so back.", nil, 0, false, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@bot.server_create do |event|
|
|
||||||
server = event.server
|
|
||||||
bot_profile = server.bot
|
|
||||||
|
|
||||||
# Prevent spam on restart
|
|
||||||
# Check if the bot joined a server in the last 60 seconds
|
|
||||||
next if bot_profile.joined_at && (Time.now - bot_profile.joined_at) > 60
|
|
||||||
|
|
||||||
# Try system channel first.
|
|
||||||
# If nil or no permissions, search text channels.
|
|
||||||
channel = server.system_channel
|
|
||||||
|
|
||||||
unless channel && bot_profile.permission?(:send_messages, channel)
|
|
||||||
channel = server.text_channels.find { |c| bot_profile.permission?(:send_messages, c) }
|
|
||||||
end
|
|
||||||
|
|
||||||
next unless channel
|
|
||||||
|
|
||||||
random_color = ("0x" + Random.bytes(3).unpack1('H*')).to_i(16)
|
|
||||||
|
|
||||||
channel.send_embed do |embed|
|
|
||||||
embed.title = "cheeseBot has joined!"
|
|
||||||
embed.description = "What now?"
|
|
||||||
embed.color = random_color
|
|
||||||
embed.timestamp = Time.now
|
|
||||||
|
|
||||||
embed.add_field(name: "Well...", value: "You can start with the /help command!")
|
|
||||||
embed.add_field(name: "And then?", value: "Start trying out the rest of commands!")
|
|
||||||
embed.add_field(name: "Sounds good!", value: "We hope you enjoy cheeseBot! Stay cheesy :)")
|
|
||||||
|
|
||||||
embed.footer = Discordrb::Webhooks::EmbedFooter.new(
|
|
||||||
text: "Be advised this bot automatically sends DMs when detected. Use /blacklist to not receive DMs."
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user