-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshrkbot.rb
79 lines (63 loc) · 2.18 KB
/
shrkbot.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require 'cinch'
require 'yaml'
require 'yaml/store'
$login = YAML.load_file(".login")
$botowner = $login['botowner']
require_relative 'modules/ChannelSystem'
$channels = YAML.load_file('.channels')
$moderators = {} #Used for all the mod-only commands in the plugins. Automatically updated.
$channels.keys.each do |channel_name|
$moderators[channel_name.to_s] ||= {}
end
require_relative 'modules/ModSystem'
require_relative 'modules/QuoteSystem'
require_relative 'modules/CommandSystem'
require_relative 'modules/GiveawaySystem'
require_relative 'modules/TournamentSystem'
# TODO: Put hardcoded commands in their own module, implement a word filter, implement tournament system, make code more readable.
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.chat.twitch.tv"
c.nick = $login['botname']
c.password = $login['oauth']
c.channels = $channels.keys
c.plugins.plugins = [
QuoteSystem,
CommandSystem,
GiveawaySystem,
ChannelSystem,
ModSystem,
TournamentSystem
]
end
on :connect do
#Requests twitch capabilities needed e.g. for the automatic modlist update.
bot.irc.send ("CAP REQ :twitch.tv/membership")
bot.irc.send ("CAP REQ :twitch.tv/commands")
# Confirms in each channel it connected successfully and requests the modlist.
$channels.keys.each do |channel|
Channel(channel).send("Connected!")
Channel(channel).send("/mods")
end
end
# Hardcoded commands. Will be moved to a separate module soon.
on :message, "!vanish" do |m|#Selfpurge
m.reply "/p #{m.user.nick}"
m.reply "Voilá"
end
on :message, "!mylife" do |m|#Requires !ffz for full effect.
m.reply "#{m.user.nick}'s life: BertLife"
end
on :message, "PB pace?" do |m|
m.reply "PB pace!"
end
on :message, "ping" do |m|
return unless $moderators[m.channel.to_s].include?(m.user.nick)
m.reply "I'm busy."
end
on :message, /Warum so ist?/ do |m|
return unless m.user.nick.eql?("trueblackshark")
m.reply "Keiner weiß!"
end
end
bot.start