update delete
This commit is contained in:
parent
caba808d8b
commit
24bf4dc386
8
bot.go
8
bot.go
@ -121,8 +121,12 @@ func botDelete(m *tb.Message) {
|
|||||||
if m.Sender.ID == int(bot.Config.AdminID) {
|
if m.Sender.ID == int(bot.Config.AdminID) {
|
||||||
r := regexp.MustCompile("/delete (?P<CompanyID>[0-9]+)")
|
r := regexp.MustCompile("/delete (?P<CompanyID>[0-9]+)")
|
||||||
ID64, _ := strconv.ParseInt(r.ReplaceAllString(m.Text, "${CompanyID}"), 10, 64)
|
ID64, _ := strconv.ParseInt(r.ReplaceAllString(m.Text, "${CompanyID}"), 10, 64)
|
||||||
srv.DeleteCompany(uint8(ID64))
|
if _, ok := srv.Status.Companies[uint8(ID64)]; ok {
|
||||||
bot.SendChat(m.Chat.ID, "Deleting")
|
srv.DeleteCompany(uint8(ID64))
|
||||||
|
bot.SendChat(m.Chat.ID, "Deleting")
|
||||||
|
} else {
|
||||||
|
bot.SendChat(m.Chat.ID, "Company doesn't exist")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bot.SendChat(m.Chat.ID, "Not authorized to delete")
|
bot.SendChat(m.Chat.ID, "Not authorized to delete")
|
||||||
}
|
}
|
||||||
|
4
ttd.go
4
ttd.go
@ -624,11 +624,11 @@ func (s *ServerTTD) ComputeClientTime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServerTTD) DeleteCompany(id uint8) {
|
func (s *ServerTTD) DeleteCompany(id uint8) {
|
||||||
if _, ok := s.Status.Companies[id]; ok {
|
if co, ok := s.Status.Companies[id]; ok {
|
||||||
logInfoDebug("Server.DeleteCompany : deleting #%d", id)
|
logInfoDebug("Server.DeleteCompany : deleting #%d", id)
|
||||||
px := PacketAdminRCon{
|
px := PacketAdminRCon{
|
||||||
Packet: Packet{PType: AdminPacketAdminRCon},
|
Packet: Packet{PType: AdminPacketAdminRCon},
|
||||||
Command: fmt.Sprintf("reset_company %d", id),
|
Command: fmt.Sprintf("reset_company %d", co.CompanyExtlID),
|
||||||
}
|
}
|
||||||
s.Send(px.Bytes())
|
s.Send(px.Bytes())
|
||||||
px = PacketAdminRCon{
|
px = PacketAdminRCon{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by version.sh (@generated) DO NOT EDIT.
|
// Code generated by version.sh (@generated) DO NOT EDIT.
|
||||||
package main
|
package main
|
||||||
var githash = "0d5c94e"
|
var githash = "caba808"
|
||||||
var buildstamp = "2021-11-10_07:04:16"
|
var buildstamp = "2021-11-12_01:17:14"
|
||||||
var commits = "187"
|
var commits = "188"
|
||||||
var version = "0d5c94e-b187 - 2021-11-10_07:04:16"
|
var version = "caba808-b188 - 2021-11-12_01:17:14"
|
||||||
|
Loading…
Reference in New Issue
Block a user