-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot_info.rb
51 lines (44 loc) · 1.54 KB
/
bot_info.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true
require 'cinch'
require_relative 'config/check_ignore'
module Cinch
module Plugins
class BotInfo
include Cinch::Plugin
set :plugin_name, 'botinfo'
set :help, <<-USAGE.gsub(/^ {6}/, '')
You can use this plugin to get more information about me!
Usage:
* !info: I will give you information about myself.
USAGE
match 'info'
def execute(m)
return if check_ignore(m.user)
rVersion = RUBY_VERSION
rPlatform = RUBY_PLATFORM
rRelease = RUBY_RELEASE_DATE
bVersion = @bot.realname
channels = @bot.channels.sort.join(', ')
channelsCount = @bot.channels.length
name = @bot.nick
pluginCount = @bot.plugins.count
cinchVersion = Cinch::VERSION
users = proc {
users = []
@bot.channels.each do |c|
c.users.each do |u|
users << u[0].nick
end
end
users.uniq.size
}.call
m.user.send "Hello #{m.user.nick},"
m.user.send "My name is #{name} running #{bVersion}!"
m.user.send "I use the Cinch Framework, my current Cinch version is #{cinchVersion}!"
m.user.send "I am running #{pluginCount} plugins!"
m.user.send "I am on #{channelsCount} channels: #{channels}. Serving #{users} users!"
m.user.send "I am programmed in Ruby. My current Ruby version is #{rVersion} released #{rRelease}, using #{rPlatform}."
end
end
end
end