Advertisement
Guest User

Untitled

a guest
May 27th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.34 KB | None | 0 0
  1.  
  2. Imports Discord
  3. Imports Discord.Commands
  4.  
  5. <Group("boss")>
  6. Public Class cmd_boss
  7. Inherits ModuleBase
  8.  
  9.  
  10. <Command>
  11. Public Async Function rng(day As DayOfWeek) As Task
  12. Try
  13. Dim strSched(,) As String
  14. Dim intRowCount As Integer = 8
  15. Dim intColumnCount As Integer = 8
  16. ReDim strSched(intColumnCount - 1, intRowCount - 1)
  17.  
  18. #Region "Schedule"
  19. strSched(0, 0) = "01:30:00 "
  20. strSched(1, 0) = "Kzarka "
  21. strSched(2, 0) = "Nouver "
  22. strSched(3, 0) = "Kzarka "
  23. strSched(4, 0) = "Kutum "
  24. strSched(5, 0) = "Kzarka "
  25. strSched(6, 0) = "Karanda "
  26. strSched(7, 0) = "Karanda "
  27. 'second row
  28. strSched(0, 1) = "07:00:00 "
  29. strSched(1, 1) = "Karanda "
  30. strSched(2, 1) = "Kutum/Nouver "
  31. strSched(3, 1) = "%Maintenance% "
  32. strSched(4, 1) = "Nouver "
  33. strSched(5, 1) = "- "
  34. strSched(6, 1) = "Nouver "
  35. strSched(7, 1) = "Kutum "
  36. 'third row
  37. strSched(0, 2) = "11:00:00 "
  38. strSched(1, 2) = "- "
  39. strSched(2, 2) = "Kzarka/Karanda "
  40. strSched(3, 2) = "Kzarka "
  41. strSched(4, 2) = "Kzarka "
  42. strSched(5, 2) = "Kutum "
  43. strSched(6, 2) = "Kutum/Kzarka "
  44. strSched(7, 2) = "Kzarka/Karanda "
  45. 'fourth row
  46. strSched(0, 3) = "15:00:00 "
  47. strSched(1, 3) = "Nouver "
  48. strSched(2, 3) = "Kutum/Nouver "
  49. strSched(3, 3) = "Karanda "
  50. strSched(4, 3) = "Kutum "
  51. strSched(5, 3) = "Kzarka "
  52. strSched(6, 3) = "Karanda/Nouver "
  53. strSched(7, 3) = "Kutum/Nouver "
  54. 'fifth row
  55. strSched(0, 4) = "20:00:00 "
  56. strSched(1, 4) = "Kzarka "
  57. strSched(2, 4) = "Muraka/Quint "
  58. strSched(3, 4) = "Kutum "
  59. strSched(4, 4) = "Kzarka/Karanda "
  60. strSched(5, 4) = "Nouver "
  61. strSched(6, 4) = "Muraka/Quint "
  62. strSched(7, 4) = "Karanda "
  63. 'sixth row
  64. strSched(0, 5) = "21:00:00 "
  65. strSched(1, 5) = "NODE WAR "
  66. strSched(2, 5) = "NODE WAR "
  67. strSched(3, 5) = "NODE WAR "
  68. strSched(4, 5) = "NODE WAR "
  69. strSched(5, 5) = "NODE WAR "
  70. strSched(6, 5) = "CONQUEST WAR "
  71. strSched(7, 5) = "NODE WAR "
  72. 'seventh row
  73. strSched(0, 6) = "00:00:00 "
  74. strSched(1, 6) = "Offin "
  75. strSched(2, 6) = "Kutum/Nouver "
  76. strSched(3, 6) = "Offin "
  77. strSched(4, 6) = "Kzarka/Nouver "
  78. strSched(5, 6) = "Offin "
  79. strSched(6, 6) = "CONQUEST WAR "
  80. strSched(7, 6) = "Kutum/Nouver "
  81. #End Region
  82. Dim timeNow As String = DateTime.Now.ToString("HH:mm:ss")
  83.  
  84. 'Dim dayz = 0
  85.  
  86. 'For x = 0 To 6
  87. ' If strSched(dayz + 1, x) <> "none" Then
  88. ' Await ReplyAsync($"{ strSched(0, x) & " > " & strSched(dayz + 1, x) & " > spawning in > " & computeInterval(timeNow, strSched(0, x)) }")
  89. ' End If
  90. 'Next x
  91.  
  92. 'Dim xDay = Context.Message.Timestamp.DayOfWeek
  93. Dim xDay = Context.Message.Timestamp.LocalDateTime.DayOfWeek
  94.  
  95. Select Case xDay
  96. Case xDay.Monday
  97. If xDay = day Then
  98. Await ReplyAsync($"**:alarm_clock: {Context.User.Mention}, {xDay}'s Boss Schedule**" & vbNewLine &
  99. $"```autohotkey" & vbNewLine &
  100. $"{ strSched(0, 0) & " > " & strSched(1, 0) & " > spawning in > " & computeInterval(timeNow, strSched(0, 0)) }" & vbNewLine &
  101. $"{ strSched(0, 1) & " > " & strSched(1, 1) & " > spawning in > " & computeInterval(timeNow, strSched(0, 1)) }" & vbNewLine &
  102. $"{ strSched(0, 2) & " > " & strSched(1, 2) & " > spawning in > " & computeInterval(timeNow, strSched(0, 2)) }" & vbNewLine &
  103. $"{ strSched(0, 3) & " > " & strSched(1, 3) & " > spawning in > " & computeInterval(timeNow, strSched(0, 3)) }" & vbNewLine &
  104. $"{ strSched(0, 4) & " > " & strSched(1, 4) & " > spawning in > " & computeInterval(timeNow, strSched(0, 4)) }" & vbNewLine &
  105. $"{ strSched(0, 5) & " > " & strSched(1, 5) & " > spawning in > " & computeInterval(timeNow, strSched(0, 5)) }" & vbNewLine &
  106. $"{ strSched(0, 6) & " > " & strSched(1, 6) & " > spawning in > " & computeInterval(timeNow, strSched(0, 6)) }" & vbNewLine &
  107. $"```")
  108. End If
  109. Await Me.Context.Message.DeleteAsync()
  110.  
  111. Case xDay.Tuesday
  112. If xDay = day Then
  113. Await ReplyAsync($"**:alarm_clock: {Context.User.Mention}, {xDay}'s Boss Schedule**" & vbNewLine &
  114. $"```md" & vbNewLine &
  115. $"{ strSched(0, 0) & " > " & strSched(2, 0) & " > spawning in > " & computeInterval(timeNow, strSched(0, 0)) }" & vbNewLine &
  116. $"{ strSched(0, 1) & " > " & strSched(2, 1) & " > spawning in > " & computeInterval(timeNow, strSched(0, 1)) }" & vbNewLine &
  117. $"{ strSched(0, 2) & " > " & strSched(2, 2) & " > spawning in > " & computeInterval(timeNow, strSched(0, 2)) }" & vbNewLine &
  118. $"{ strSched(0, 3) & " > " & strSched(2, 3) & " > spawning in > " & computeInterval(timeNow, strSched(0, 3)) }" & vbNewLine &
  119. $"{ strSched(0, 4) & " > " & strSched(2, 4) & " > spawning in > " & computeInterval(timeNow, strSched(0, 4)) }" & vbNewLine &
  120. $"{ strSched(0, 5) & " > " & strSched(2, 5) & " > spawning in > " & computeInterval(timeNow, strSched(0, 5)) }" & vbNewLine &
  121. $"{ strSched(0, 6) & " > " & strSched(2, 6) & " > spawning in > " & computeInterval(timeNow, strSched(0, 6)) }" & vbNewLine &
  122. $"```")
  123. End If
  124.  
  125. Await Me.Context.Message.DeleteAsync()
  126.  
  127. Case xDay.Wednesday
  128. If xDay = xDay Then
  129. Await ReplyAsync($"**:alarm_clock: {Context.User.Mention}, {xDay}'s Boss Schedule**" & vbNewLine &
  130. $"```autohotkey" & vbNewLine &
  131. $"{ strSched(0, 0) & " > " & strSched(3, 0) & " > spawning in > " & computeInterval(timeNow, strSched(0, 0)) }" & vbNewLine &
  132. $"{ strSched(0, 1) & " > " & strSched(3, 1) & " > spawning in > " & computeInterval(timeNow, strSched(0, 1)) }" & vbNewLine &
  133. $"{ strSched(0, 2) & " > " & strSched(3, 2) & " > spawning in > " & computeInterval(timeNow, strSched(0, 2)) }" & vbNewLine &
  134. $"{ strSched(0, 3) & " > " & strSched(3, 3) & " > spawning in > " & computeInterval(timeNow, strSched(0, 3)) }" & vbNewLine &
  135. $"{ strSched(0, 4) & " > " & strSched(3, 4) & " > spawning in > " & computeInterval(timeNow, strSched(0, 4)) }" & vbNewLine &
  136. $"{ strSched(0, 5) & " > " & strSched(3, 5) & " > spawning in > " & computeInterval(timeNow, strSched(0, 5)) }" & vbNewLine &
  137. $"{ strSched(0, 6) & " > " & strSched(3, 6) & " > spawning in > " & computeInterval(timeNow, strSched(0, 6)) }" & vbNewLine &
  138. $"```")
  139. End If
  140. Await Me.Context.Message.DeleteAsync()
  141.  
  142. Case xDay.Thursday
  143. If xDay = xDay Then
  144. Await ReplyAsync($"**:alarm_clock: {Context.User.Mention}, {xDay}'s Boss Schedule**" & vbNewLine &
  145. $"```autohotkey" & vbNewLine &
  146. $"{ strSched(0, 0) & " > " & strSched(4, 0) & " > spawning in > " & computeInterval(timeNow, strSched(0, 0)) }" & vbNewLine &
  147. $"{ strSched(0, 1) & " > " & strSched(4, 1) & " > spawning in > " & computeInterval(timeNow, strSched(0, 1)) }" & vbNewLine &
  148. $"{ strSched(0, 2) & " > " & strSched(4, 2) & " > spawning in > " & computeInterval(timeNow, strSched(0, 2)) }" & vbNewLine &
  149. $"{ strSched(0, 3) & " > " & strSched(4, 3) & " > spawning in > " & computeInterval(timeNow, strSched(0, 3)) }" & vbNewLine &
  150. $"{ strSched(0, 4) & " > " & strSched(4, 4) & " > spawning in > " & computeInterval(timeNow, strSched(0, 4)) }" & vbNewLine &
  151. $"{ strSched(0, 5) & " > " & strSched(4, 5) & " > spawning in > " & computeInterval(timeNow, strSched(0, 5)) }" & vbNewLine &
  152. $"{ strSched(0, 6) & " > " & strSched(4, 6) & " > spawning in > " & computeInterval(timeNow, strSched(0, 6)) }" & vbNewLine &
  153. $"```")
  154. End If
  155. Await Me.Context.Message.DeleteAsync()
  156.  
  157. Case xDay.Friday
  158. If xDay = xDay Then
  159. Await ReplyAsync($"**:alarm_clock: {Context.User.Mention}, {xDay}'s Boss Schedule**" & vbNewLine &
  160. $"```autohotkey" & vbNewLine &
  161. $"{ strSched(0, 0) & " > " & strSched(5, 0) & " > spawning in > " & computeInterval(timeNow, strSched(0, 0)) }" & vbNewLine &
  162. $"{ strSched(0, 1) & " > " & strSched(5, 1) & " > spawning in > " & computeInterval(timeNow, strSched(0, 1)) }" & vbNewLine &
  163. $"{ strSched(0, 2) & " > " & strSched(5, 2) & " > spawning in > " & computeInterval(timeNow, strSched(0, 2)) }" & vbNewLine &
  164. $"{ strSched(0, 3) & " > " & strSched(5, 3) & " > spawning in > " & computeInterval(timeNow, strSched(0, 3)) }" & vbNewLine &
  165. $"{ strSched(0, 4) & " > " & strSched(5, 4) & " > spawning in > " & computeInterval(timeNow, strSched(0, 4)) }" & vbNewLine &
  166. $"{ strSched(0, 5) & " > " & strSched(5, 5) & " > spawning in > " & computeInterval(timeNow, strSched(0, 5)) }" & vbNewLine &
  167. $"{ strSched(0, 6) & " > " & strSched(5, 6) & " > spawning in > " & computeInterval(timeNow, strSched(0, 6)) }" & vbNewLine &
  168. $"```")
  169. End If
  170. Await Me.Context.Message.DeleteAsync()
  171.  
  172. Case xDay.Saturday
  173. If xDay = xDay Then
  174. Await ReplyAsync($"**:alarm_clock: {Context.User.Mention}, {xDay}'s Boss Schedule**" & vbNewLine &
  175. $"```autohotkey" & vbNewLine &
  176. $"{ strSched(0, 0) & " > " & strSched(6, 0) & " > spawning in > " & computeInterval(timeNow, strSched(0, 0)) }" & vbNewLine &
  177. $"{ strSched(0, 1) & " > " & strSched(6, 1) & " > spawning in > " & computeInterval(timeNow, strSched(0, 1)) }" & vbNewLine &
  178. $"{ strSched(0, 2) & " > " & strSched(6, 2) & " > spawning in > " & computeInterval(timeNow, strSched(0, 2)) }" & vbNewLine &
  179. $"{ strSched(0, 3) & " > " & strSched(6, 3) & " > spawning in > " & computeInterval(timeNow, strSched(0, 3)) }" & vbNewLine &
  180. $"{ strSched(0, 4) & " > " & strSched(6, 4) & " > spawning in > " & computeInterval(timeNow, strSched(0, 4)) }" & vbNewLine &
  181. $"{ strSched(0, 5) & " > " & strSched(6, 5) & " > spawning in > " & computeInterval(timeNow, strSched(0, 5)) }" & vbNewLine &
  182. $"{ strSched(0, 6) & " > " & strSched(6, 6) & " > spawning in > " & computeInterval(timeNow, strSched(0, 6)) }" & vbNewLine &
  183. $"```")
  184. End If
  185. Await Me.Context.Message.DeleteAsync()
  186.  
  187. Case xDay.Sunday
  188. If xDay = xDay Then
  189. Await ReplyAsync($"**:alarm_clock: {Context.User.Mention}, {xDay}'s Boss Schedule**" & vbNewLine &
  190. $"```autohotkey" & vbNewLine &
  191. $"{ strSched(0, 0) & " > " & strSched(7, 0) & " > spawning in > " & computeInterval(timeNow, strSched(0, 0)) }" & vbNewLine &
  192. $"{ strSched(0, 1) & " > " & strSched(7, 1) & " > spawning in > " & computeInterval(timeNow, strSched(0, 1)) }" & vbNewLine &
  193. $"{ strSched(0, 2) & " > " & strSched(7, 2) & " > spawning in > " & computeInterval(timeNow, strSched(0, 2)) }" & vbNewLine &
  194. $"{ strSched(0, 3) & " > " & strSched(7, 3) & " > spawning in > " & computeInterval(timeNow, strSched(0, 3)) }" & vbNewLine &
  195. $"{ strSched(0, 4) & " > " & strSched(7, 4) & " > spawning in > " & computeInterval(timeNow, strSched(0, 4)) }" & vbNewLine &
  196. $"{ strSched(0, 5) & " > " & strSched(7, 5) & " > spawning in > " & computeInterval(timeNow, strSched(0, 5)) }" & vbNewLine &
  197. $"{ strSched(0, 6) & " > " & strSched(7, 6) & " > spawning in > " & computeInterval(timeNow, strSched(0, 6)) }" & vbNewLine &
  198. $"```")
  199. End If
  200.  
  201. Await Me.Context.Message.DeleteAsync()
  202. End Select
  203.  
  204.  
  205.  
  206. Catch ex As Exception
  207. Console.Write("[Boss] " & ex.Message)
  208. End Try
  209.  
  210.  
  211. End Function
  212.  
  213. Function computeInterval(stamp As DateTime, bossTime As String) As String
  214. Dim dateFrom As DateTime
  215. Dim dateTo As DateTime
  216. Dim strSpan As String
  217. If DateTime.TryParse(stamp, dateFrom) AndAlso DateTime.TryParse(bossTime, dateTo) Then
  218. Dim spanTime As TimeSpan = dateTo - dateFrom
  219. Dim hour As Integer = spanTime.Hours
  220. Dim mins As Integer = spanTime.Minutes
  221. Dim secs As Integer = spanTime.Seconds
  222. If hour >= 0 AndAlso mins >= 0 AndAlso secs >= 0 Then
  223. strSpan = ((hour.ToString("00") & ":" + mins.ToString("00") & ":") + secs.ToString("00") & "")
  224. ElseIf bossTime = "00:00:00 " Then
  225. hour = hour * -1
  226. mins = mins * -1
  227. secs = secs * -1
  228. strSpan = ((hour.ToString("00") & ":" + mins.ToString("00") & ":") + secs.ToString("00") & "")
  229. Else
  230. strSpan = "%SPAWNED%"
  231. End If
  232. End If
  233. Return strSpan
  234. End Function
  235.  
  236.  
  237.  
  238. <Command>
  239. Public Async Function bosshelp() As Task
  240. Await ReplyAsync($"**:tools: {Context.User.Mention}, Help: Boss Timer Command (!boss)**" & vbNewLine &
  241. "```Syntax is: !boss <current day>" & vbNewLine &
  242. "Sample: !boss tuesday, this will tell the bot to show the schedule on Tuesday.```")
  243. Await Me.Context.Message.DeleteAsync()
  244. End Function
  245. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement