-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask5.rb
More file actions
56 lines (42 loc) · 800 Bytes
/
task5.rb
File metadata and controls
56 lines (42 loc) · 800 Bytes
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
require 'discordrb'
require "date"
DISCORD_TOKEN = '..-'
CLIENT_ID =
CHANNEL_ID = 531643454846009344
CHANNEL_ID_DEBUG = 532940099412033537
USER_ID = 531657432544313345
@bot = Discordrb::Commands::CommandBot.new token: DISCORD_TOKEN, client_id: CLIENT_ID, prefix: '!'
h = 0
m = 0
sleep(5)
ltid = 0
file = File.open("/home/daburutti/DKC_bot/time")
file.each do |a|
ltid = a.to_i
end
if ltid == 0 then
puts "closed"
return
end
nowTime = DateTime.now
case ltid
when 1 then
h = 21
m = 0
when 2 then
h = 21
m = 30
when 3 then
h = 22
m = 00
end
now_h = nowTime.hour
now_m = nowTime.minute
puts ltid
puts h
puts m
if h == now_h && m == now_m then
@bot.send_message(CHANNEL_ID,"<@&532903286613999617> 全員集合!| Everyone gather!!")
else
return
end