Bots mIRC Twitch.tv机器人点系统打开和关闭命令

Bots mIRC Twitch.tv机器人点系统打开和关闭命令,bots,points,mirc,twitch,Bots,Points,Mirc,Twitch,我目前正在开发twitch.tv机器人。机器人的设计目的是当用户加入mIRC端的聊天时自动给他们打分。计时器启动后,他们每30分钟获得1分。问题是我不希望人们在聊天时afk流被关闭,所以我想输入一个类似“!pointstimer start”的命令。当该命令运行时,我希望它显示计时器已启动的消息。我希望这个命令也是op-only,这样其他人就不能在他们认为合适的任何时候运行这个命令。我有积分系统,也有抽奖系统。问题是,当我输入命令打开和关闭积分系统时,什么都没有发生。如果命令不是op,我可以让它

我目前正在开发twitch.tv机器人。机器人的设计目的是当用户加入mIRC端的聊天时自动给他们打分。计时器启动后,他们每30分钟获得1分。问题是我不希望人们在聊天时afk流被关闭,所以我想输入一个类似“!pointstimer start”的命令。当该命令运行时,我希望它显示计时器已启动的消息。我希望这个命令也是op-only,这样其他人就不能在他们认为合适的任何时候运行这个命令。我有积分系统,也有抽奖系统。问题是,当我输入命令打开和关闭积分系统时,什么都没有发生。如果命令不是op,我可以让它显示文本,但如果命令是op,则什么也不会发生。这是我所有代码的副本

代码:

代码2:

on *:TEXT:!buytickets &:#:{
  if (!%raffle) { msg $chan Raffle is currently closed! }
  else {
    if ($int($2) < 1) { msg $chan Do you really want to buy no Tickets, $nick $+ ..? }
    elseif ($int($2) > 1000) { msg $chan Sorry $nick but you can only buy up to 1000 raffle tickets at a time. }
    else {
      var %i = 0, %ticket = $int($2)
      var %topic = $+(#,.,$nick), %user = $readini(Points.ini,%topic,Points), %end = 1 * %ticket, %delete = %user - %end
      if (%delete > 0) {
        writeini -n $qt(Points.ini) %topic Points %delete
        while (%i < %ticket) {
          write $qt(Raffle.txt) $nick
          inc %i
        }
        msg $chan $nick you have bought %ticket tickets with %end Donks.
      }
    }
  }
}
on *:TEXT:!raffle &:#:{
  if ($nick isop #) {
    if (($2 == open) && (!%raffle)) || (($2 == close) && (%raffle))  {
      msg $chan RAFFLE IS NOW $replace($upper($2!!),CLOSE,CLOSED)
      if ($2 == open) { set %raffle 1 }
      else unset %raffle
      write -c $qt(Raffle.txt)
    }
  }
}
on *:TEXT:!roll:#:{
  if ($nick isop #) && (%raffle) {
    msg $chan RAFFLE IS NOW BEING ROLLED, GOOD LUCK!!
    .timerCD 1 3 msg $chan /me $!calc( $!timer(CD).reps + 1 ) $!+ !
    .timer 1 4 msg $chan AND THE WINNER IS:
    .timer 1 5 msg $chan $read(Raffle.txt, n)
    unset %raffle
    write -c $qt(Raffle.txt)
  }
}
on*:文本:!买票&:#{
如果(!%raffle){msg$chan raffle当前已关闭!}
否则{
如果($int($2)<1){msg$chan你真的不想买票吗,$nick$+..?}
elseif($int($2)>1000){msg$chan Sorry$nick,但您一次最多只能购买1000张奖券。}
否则{
变量%i=0,%ticket=$int($2)
变量%topic=$+(#,,,$nick),%user=$readini(Points.ini,%topic,Points),%end=1*%ticket,%delete=%user-%end
如果(%delete>0){
writeini-n$qt(Points.ini)%topic Points%delete
而(%i<%ticket){
写$qt(Raffle.txt)$nick
公司%i
}
msg$chan$nick您已经用%end Donks购买了%张门票。
}
}
}
}
在*:文本:!抽奖&:#{
如果($nick isop#){
如果($2==开放)和(!%raffle))| |($2==关闭)和(%raffle)){
msg$chan抽奖现在是$replace($upper($2!!),CLOSE,CLOSE)
如果($2==open){set%raffle 1}
其他未兑现%抽奖
写入-c$qt(Raffle.txt)
}
}
}
在*:文本:!滚动:#:{
if($nick isop#)和(%抽奖){
msg$chan抽奖现正在进行,祝您好运!!
.timerCD 1 3 msg$chan/me$!calc($!timer(CD).reps+1)$!+!
.timer 1 4 msg$chan,获胜者为:
.timer 1 5 msg$chan$read(Raffle.txt,n)
未兑现%抽奖
写入-c$qt(Raffle.txt)
}
}
代码3

alias -l addPoints {
  if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt }
  var %topic $+($chan,.,$nick)
  var %points $calc($readini(Points.ini,%topic,Points) + $1)
  writeini -n Points.ini %topic Points %points
  return %points
}

alias -l lookUpPoints {
  var %topic $+($chan,.,$nick)
  var %points $readini(Points.ini,%topic,Points)
  return %points
}
alias doaddpoints {
  if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
  var %topic $+($1,.,$2)
  var %points $calc($readini(Points.ini,%topic,Points) + $3)
  writeini -n Points.ini %topic Points %points
  echo -a Added points for %topic
}

alias dorempoints {
  var %topic $+($1,.,$2)
  remini -n Points.ini %topic Points
  echo -a Removed points for %topic
}

on *:text:!donks:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total donks.
}

on $*:text:/!donks (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !donks [add|remove] [user] [number] | return }
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total donks. }
  }
  else { msg $chan This command is only available to moderators. }
}

on *:TEXT:!donktime &:#:{
  if ($nick isop #) {
    if (($2 == start) && (!%donktime)) || (($2 == stop) && (%donktime))  {
      msg $chan DONKTIME IS NOW $replace($upper($2ED!!),CLOSE,CLOSED)
      if ($2 == start) { set %donktime 1 }
      else unset %donktown
    }
  }
}

on !*:join:#:{
  if (!%donktown) {halt}
  else{
  $+(.timerpoints.,#,.,$nick) 0 1800 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)}
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}
alias-l addPoints{
如果($1!isnum){echo 2-st$1不是一个数字。它必须是一个数字。| halt}
变量%topic$+($chan,,$nick)
变量%points$calc($readini(points.ini,%topic,points)+$1)
writeini-n Points.ini%主题点%Points
返回%分
}
别名-l lookUpPoints{
变量%topic$+($chan,,$nick)
变量%points$readini(points.ini,%topic,points)
返回%分
}
别名doaddpoints{
如果($3!isnum){echo 2-st$3不是一个数字。它需要是一个数字。| halt}
变量%topic$+($1,,,,$2)
变量%points$calc($readini(points.ini,%topic,points)+$3)
writeini-n Points.ini%主题点%Points
echo-为%topic添加了点
}
别名dorempoints{
变量%topic$+($1,,,,$2)
remini-n Points.ini%主题点
echo-已删除%topic的点
}
在*:文本:!唐克斯:#{
如果((%floodpoints)| |($($+(%,floodpoints.,$nick),2)){return}
设置-u10%泛洪点
设置-u30%泛洪点。$+$nick开启
msg#$nick总共有$readini(Points.ini,$+(#,,,$nick),Points)。
}
关于$*:text:/!唐克斯(添加|删除)/Si:#:{
如果($nick isop#){
如果($0<3){msg#参数不足:使用!donks[add | remove][user][number]| return}
writeini-n Points.ini$+(#,,$3)Points$calc($readini(Points.ini,$+(#,,,,$3),Points)$iif($2==add,+,-)$iif($4 isnum,$4,1))
{msg$chan$3现在有$readini(Points.ini,$+(#,,,,$3),Points)总donks.}
}
否则{msg$chan此命令仅对版主可用。}
}
在*:文本:!donktime&:#{
如果($nick isop#){
如果($2==开始)和(!%donktime))| |($2==停止)和(%donktime)){
msg$chan DONKTIME现在是$replace($upper($2ED!!),CLOSE,CLOSE)
如果($2==start){set%donktime 1}
否则取消设置%donktown
}
}
}
开!*:加入:#{
如果(!%donktown){halt}
否则{
$+(.timerpoints.,#,,$nick)0 1800 add.pts$+(#,,,$nick)
add.pts$+(#,,$nick)}
}
开!*:部分:#:$+(.timerpoints.,#,,$nick)关闭
别名-l add.pts{
writeini-n Points.ini$1 Points$calc($readini(Points.ini$1,Points)+1)
}

提前感谢您的帮助

此类问题没有提供任何我们可以帮助您的代码。你基本上是在向我们索要代码,而没有向我们展示你迄今为止试图实现的东西,只是你目前拥有的与你的请求不一定相关的东西。因为这个原因,没有人回答或帮助你

我也正准备回答下一个问题,但因为我想看看我的mSL技能如何,我决定试一试

警告:

;###
;### PointsTimer v1
;### - Granting channel user points by fixed interval
;###    Programmer: Orel Eraki
;###    Contact: Orel.Eraki@gmail.com
;###
;### Commands: !PointsTimer START|END|STATUS

#PointsTimer on
alias -l PointsTimer.Name return PointsTimer
alias -l PointsTimer.Description return Granting channel user points by fixed interval.
alias -l PointsTimer.Author return Orel Eraki (Orel.Eraki@gmail.com)
alias -l PointsTimer.Version return 1

;### Settings
alias -l PointsTimer.Channel return #TestTest
alias -l PointsTimer.Idle return 20
alias -l PointsTimer.PointsFile return Points.ini
alias -l PointsTimer.Status return $iif(%PointsTimer, $true, $false)

;### Messages
alias -l PointsTimer.MsgStarted return System has been Started.
alias -l PointsTimer.MsgEnded return System has been Ended.
alias -l PointsTimer.MsgAlreadyStarted return System already been started.
alias -l PointsTimer.MsgNotStarted return System didn't started yet.

;### Events
on *:QUIT: .PointsTimer END-FOR-NICK $nick
on me:*:PART:$($PointsTimer.Channel): .PointsTimer END
on me:*:JOIN:$($PointsTimer.Channel): .PointsTimer END
on !*:PART:$($PointsTimer.Channel): .PointsTimer.SetNickTimer $nick OFF
on !*:JOIN:$($PointsTimer.Channel): {
  if (!$PointsTimer.Status) {
    return
  }
  PointsTimer START-FOR-NICK $nick
}
on *:NICK: {
  if (!$PointsTimer.Status) {
    return
  }
  PointsTimer RENAME $nick $newnick
}

on *:TEXT:!PointsTimer INFO:$($PointsTimer.Channel): {
  PointsTimer.Msg # $PointsTimer.Name v $+ $PointsTimer.Version By $PointsTimer.Author
  PointsTimer.Msg # $PointsTimer.Description
}

on @*:TEXT:!PointsTimer *:$($PointsTimer.Channel): {
  if ($2 == START) {
    if ($PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgAlreadyStarted
      return
    }

    PointsTimer START #
    if ($PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgStarted
    }
  }
  else if ($2 == END) {
    if (!$PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgNotStarted
      return
    }
    PointsTimer END #
    if (!$PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgEnded
    }
  }
  elseif ($2 == STATUS) {
    PointsTimer.Msg # System is currently $iif($PointsTimer.Status, ON, OFF)
  }
}

;### Commands
alias PointsTimer {
  if ($1 == START) {
    if ($PointsTimer.Status || $2 !ischan) {
      return
    }

    inc %PointsTimer
    PointsTimer.SetNicksTimer $PointsTimer.GetChannelNicks($2)
  }
  elseif ($1 == END) {
    if (!$PointsTimer.Status) {
      return
    }

    unset %PointsTimer
    .timerPointsTimer.* off
  }
  elseif ($1 == START-FOR-NICK) {
    if (!$PointsTimer.Status || !$ial($+($2,!*@*))) {
      return
    }

    PointsTimer.SetNickTimer $2
  }
  elseif ($1 == END-FOR-NICK) {
    if (!$PointsTimer.Status) {
      return
    }

    PointsTimer.SetNickTimer $2 OFF
  }
  elseif ($1 == RENAME) {
    .timer 1 0 PointsTimer END-FOR-NICK $2
    .timer 1 1 PointsTimer START-FOR-NICK $3
  }
  else {
    PointsTimer.Echo Unknown command $1
  }
}

alias -l PointsTimer.Msg msg $1 * PointsTimer: $2-
alias -l PointsTimer.Echo echo $color(info) -agt * PointsTimer: $1-

alias -l PointsTimer.GetChannelNicks {
  if ($1 !ischan) {
    return
  }

  var %i = 1, %n = $nick($1, 0)
  var %results
  while (%i <= %n) {
    %results = $addtok(%results, $nick($1, %i), 44)
    inc %i
  }
  return %results
}

alias -l PointsTimer.SetNickTimer $+(.timerPointsTimer.,$1) $iif($2 == OFF, OFF,0 $PointsTimer.Idle Add.PTS $1)

alias -l PointsTimer.SetNicksTimer {
  var %results
  var %i = 1, %n = $numtok($1, 44)
  while (%i <= %n) {
    PointsTimer.SetNickTimer $gettok($1, %i, 44)
    inc %i
  }
}

alias -l Add.PTS writeini -n $PointsTimer.PointsFile $1 Points $calc($readini($PointsTimer.PointsFile, $1, Points) + 1)
#PointsTimer End
  • 正如我之前所说,为了提高我的mSL技能,我过度使用了这个系统
  • 代码没有经过充分测试
  • 我不会指导您如何调试问题,也不会将其集成到您的系统中,因为我构建了一个几乎通用且动态的系统,以便于调试和集成,因此一个对mSL缺乏经验的人应该知道如何使用此代码实现他的目标
代码:

;###
;### PointsTimer v1
;### - Granting channel user points by fixed interval
;###    Programmer: Orel Eraki
;###    Contact: Orel.Eraki@gmail.com
;###
;### Commands: !PointsTimer START|END|STATUS

#PointsTimer on
alias -l PointsTimer.Name return PointsTimer
alias -l PointsTimer.Description return Granting channel user points by fixed interval.
alias -l PointsTimer.Author return Orel Eraki (Orel.Eraki@gmail.com)
alias -l PointsTimer.Version return 1

;### Settings
alias -l PointsTimer.Channel return #TestTest
alias -l PointsTimer.Idle return 20
alias -l PointsTimer.PointsFile return Points.ini
alias -l PointsTimer.Status return $iif(%PointsTimer, $true, $false)

;### Messages
alias -l PointsTimer.MsgStarted return System has been Started.
alias -l PointsTimer.MsgEnded return System has been Ended.
alias -l PointsTimer.MsgAlreadyStarted return System already been started.
alias -l PointsTimer.MsgNotStarted return System didn't started yet.

;### Events
on *:QUIT: .PointsTimer END-FOR-NICK $nick
on me:*:PART:$($PointsTimer.Channel): .PointsTimer END
on me:*:JOIN:$($PointsTimer.Channel): .PointsTimer END
on !*:PART:$($PointsTimer.Channel): .PointsTimer.SetNickTimer $nick OFF
on !*:JOIN:$($PointsTimer.Channel): {
  if (!$PointsTimer.Status) {
    return
  }
  PointsTimer START-FOR-NICK $nick
}
on *:NICK: {
  if (!$PointsTimer.Status) {
    return
  }
  PointsTimer RENAME $nick $newnick
}

on *:TEXT:!PointsTimer INFO:$($PointsTimer.Channel): {
  PointsTimer.Msg # $PointsTimer.Name v $+ $PointsTimer.Version By $PointsTimer.Author
  PointsTimer.Msg # $PointsTimer.Description
}

on @*:TEXT:!PointsTimer *:$($PointsTimer.Channel): {
  if ($2 == START) {
    if ($PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgAlreadyStarted
      return
    }

    PointsTimer START #
    if ($PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgStarted
    }
  }
  else if ($2 == END) {
    if (!$PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgNotStarted
      return
    }
    PointsTimer END #
    if (!$PointsTimer.Status) {
      PointsTimer.Msg # $PointsTimer.MsgEnded
    }
  }
  elseif ($2 == STATUS) {
    PointsTimer.Msg # System is currently $iif($PointsTimer.Status, ON, OFF)
  }
}

;### Commands
alias PointsTimer {
  if ($1 == START) {
    if ($PointsTimer.Status || $2 !ischan) {
      return
    }

    inc %PointsTimer
    PointsTimer.SetNicksTimer $PointsTimer.GetChannelNicks($2)
  }
  elseif ($1 == END) {
    if (!$PointsTimer.Status) {
      return
    }

    unset %PointsTimer
    .timerPointsTimer.* off
  }
  elseif ($1 == START-FOR-NICK) {
    if (!$PointsTimer.Status || !$ial($+($2,!*@*))) {
      return
    }

    PointsTimer.SetNickTimer $2
  }
  elseif ($1 == END-FOR-NICK) {
    if (!$PointsTimer.Status) {
      return
    }

    PointsTimer.SetNickTimer $2 OFF
  }
  elseif ($1 == RENAME) {
    .timer 1 0 PointsTimer END-FOR-NICK $2
    .timer 1 1 PointsTimer START-FOR-NICK $3
  }
  else {
    PointsTimer.Echo Unknown command $1
  }
}

alias -l PointsTimer.Msg msg $1 * PointsTimer: $2-
alias -l PointsTimer.Echo echo $color(info) -agt * PointsTimer: $1-

alias -l PointsTimer.GetChannelNicks {
  if ($1 !ischan) {
    return
  }

  var %i = 1, %n = $nick($1, 0)
  var %results
  while (%i <= %n) {
    %results = $addtok(%results, $nick($1, %i), 44)
    inc %i
  }
  return %results
}

alias -l PointsTimer.SetNickTimer $+(.timerPointsTimer.,$1) $iif($2 == OFF, OFF,0 $PointsTimer.Idle Add.PTS $1)

alias -l PointsTimer.SetNicksTimer {
  var %results
  var %i = 1, %n = $numtok($1, 44)
  while (%i <= %n) {
    PointsTimer.SetNickTimer $gettok($1, %i, 44)
    inc %i
  }
}

alias -l Add.PTS writeini -n $PointsTimer.PointsFile $1 Points $calc($readini($PointsTimer.PointsFile, $1, Points) + 1)
#PointsTimer End
###
;### 指针刺激器v1
;### - 按固定间隔授予通道用户点
;###    程序员:Orel Eraki
;###    联系人:奥雷尔。Eraki@gmail.com
;###
;### 命令:!指针指示器开始|结束|状态
#指针刺激
别名-l PointsTimer.Name返回PointsTimer
别名-l PointsTimer。说明返回按固定间隔授予通道用户点。
别名-l PointsTimer。作者返回Orel Eraki(Orel。Eraki@gmail.com)
别名-l指针刺激器。版本返回1
;### 设置
别名-l指针刺激器。通道返回#测试
别名-l指针刺激器。空闲返回20
别名-l PointsTimer.Points文件返回点.ini
别名-l指针刺激器。状态返回$iif(%P