This commit is contained in:
shoopea 2019-12-29 15:50:56 +08:00
parent bc838c98dc
commit 7410c9dcd3
10 changed files with 717 additions and 518 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,824 +1,687 @@
[
{
"id": "101",
"intl_id": "user",
"name": "User",
"obj_type_id": "1"
"obj_type": "user"
},
{
"id": "201",
"intl_id": "guild",
"name": "Guild",
"obj_type_id": "2"
"obj_type": "guild"
},
{
"id": "301",
"intl_id": "unknown",
"name": "Unknown",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "302",
"intl_id": "war",
"name": "War report",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "304",
"intl_id": "guild_war",
"name": "Guilds war report",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "305",
"intl_id": "report_req",
"name": "Player war report request",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "306",
"intl_id": "report_ack",
"name": "Player war report ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "307",
"intl_id": "g_report_req",
"name": "Player guilds war report request",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "308",
"intl_id": "g_report_ack",
"name": "Player guilds war report ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "309",
"intl_id": "quest_res",
"name": "Quest result",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "310",
"intl_id": "duel_fight",
"name": "Duel fight result",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "311",
"intl_id": "hero_req",
"name": "Hero summary request",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "312",
"intl_id": "hero_ack",
"name": "Hero summary ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "313",
"intl_id": "me_req",
"name": "Hero short summary request",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "314",
"intl_id": "me_ack",
"name": "Hero short summary ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "315",
"intl_id": "inv_req",
"name": "Inventory request",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "316",
"intl_id": "inv_ack",
"name": "Inventory ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "317",
"intl_id": "pillage_inc",
"name": "Pillage incoming",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "318",
"intl_id": "pillage_go",
"name": "Pillage go",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "319",
"intl_id": "pillage_timeout",
"name": "Pillage timeout",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "320",
"intl_id": "pillage_win",
"name": "Pillage win",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "321",
"intl_id": "pillage_loss",
"name": "Pillage loss",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "322",
"intl_id": "tribute_inc",
"name": "Tribute incoming",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "323",
"intl_id": "tribute_ack",
"name": "Tribute acknowledged",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "324",
"intl_id": "auction_announce",
"name": "Auction announce",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "325",
"intl_id": "auction_upd_req",
"name": "Auction update request",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "326",
"intl_id": "auction_upd_ack",
"name": "Auction update acknowledgment",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "327",
"intl_id": "time_ack",
"name": "Time Acknowledgment",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "328",
"intl_id": "time_req",
"name": "Time Request",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "329",
"intl_id": "go",
"name": "Go",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "330",
"intl_id": "pledge",
"name": "Pledge",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "331",
"intl_id": "go_quest_req",
"name": "Go quest Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "332",
"intl_id": "fast_fight",
"name": "Arena fast fight",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "333",
"intl_id": "go_arena",
"name": "Go arena",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "334",
"intl_id": "top",
"name": "Top",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "335",
"intl_id": "menu",
"name": "Menu",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "336",
"intl_id": "buy_req",
"name": "Sell Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "337",
"intl_id": "sell_req",
"name": "Buy Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "338",
"intl_id": "orderbook_req",
"name": "Orderbook Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "339",
"intl_id": "orderbook_acl",
"name": "Orderbook Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "340",
"intl_id": "withdraw_req",
"name": "Withdraw Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "341",
"intl_id": "withdraw_code",
"name": "Withdraw Code",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "342",
"intl_id": "withdraw_rcv",
"name": "Withdraw Received",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "343",
"intl_id": "stock_req",
"name": "Stock Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "344",
"intl_id": "stock_ack",
"name": "Stock Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "345",
"intl_id": "misc_req",
"name": "Misc Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "346",
"intl_id": "misc_ack",
"name": "Misc Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "347",
"intl_id": "union_war",
"name": "Union war report",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "348",
"intl_id": "tureport_req",
"name": "Trade Union War Report Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "349",
"intl_id": "tureport_ack",
"name": "Trade Union War Report Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "350",
"intl_id": "timeout",
"name": "Generic timeout",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "351",
"intl_id": "go_quest_ack",
"name": "Go Quest Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "352",
"intl_id": "groles_req",
"name": "Guild roles Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "353",
"intl_id": "groles_ack",
"name": "Guild roles Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "354",
"intl_id": "gstock_res_req",
"name": "GStock Res Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "355",
"intl_id": "gstock_alch_req",
"name": "GStock Alch Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "356",
"intl_id": "gstock_misc_req",
"name": "GStock Misc Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "357",
"intl_id": "gstock_rec_req",
"name": "GStock Rec Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "358",
"intl_id": "gstock_part_req",
"name": "GStock Part Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "359",
"intl_id": "gstock_oth_req",
"name": "Gstock Oth Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "360",
"intl_id": "gstock_any_ack",
"name": "Gstock Any Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "361",
"intl_id": "gstock_req",
"name": "GStock Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "362",
"intl_id": "gstock_ack",
"name": "GStock Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "363",
"intl_id": "busy",
"name": "Busy",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "364",
"intl_id": "res_stock_req",
"name": "Resources Stock Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "365",
"intl_id": "alch_stock_req",
"name": "Alchemy Stock Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "366",
"intl_id": "misc_stock_req",
"name": "Misc Stock Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "367",
"intl_id": "equip_stock_req",
"name": "Equipment Stock Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "368",
"intl_id": "craft_stock_req",
"name": "Equipment Stock Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "369",
"intl_id": "stock_empty",
"name": "Stock Empty",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "370",
"intl_id": "stock_any_ack",
"name": "Stock Any Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "371",
"intl_id": "g_deposit_req",
"name": "GDeposit Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "372",
"intl_id": "g_deposit_ack",
"name": "GDeposit Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "373",
"intl_id": "castle_attack_req",
"name": "Castle Attack Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "374",
"intl_id": "castle_attack_ack",
"name": "Castle Attack Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "375",
"intl_id": "castle_target_req",
"name": "Castle Target Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "376",
"intl_id": "castle_target_ack",
"name": "Castle Target Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "377",
"intl_id": "castle_def_req",
"name": "Castle Defense Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "378",
"intl_id": "castle_def_ack",
"name": "Castle Defense Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "379",
"intl_id": "back",
"name": "Back",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "380",
"intl_id": "castle_req",
"name": "Castle Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "381",
"intl_id": "castle_ack",
"name": "Castle Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "382",
"intl_id": "exchange_req",
"name": "Exchange Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "383",
"intl_id": "exchange_ack",
"name": "Exchange Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "384",
"intl_id": "equip_req",
"name": "Equip Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "385",
"intl_id": "equip_ack",
"name": "Equip Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "386",
"intl_id": "unequip_req",
"name": "Unequip Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "387",
"intl_id": "unequip_ack",
"name": "Unequip Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "388",
"intl_id": "no_stamina",
"name": "No Stamina",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "389",
"intl_id": "orderbook_search",
"name": "Orderbook search",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "390",
"intl_id": "quest_req",
"name": "Quest Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "391",
"intl_id": "quest_ack",
"name": "Quest Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "392",
"intl_id": "battle",
"name": "Battle",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "393",
"intl_id": "order_cancel_req",
"name": "Order Cancel Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "394",
"intl_id": "order_cancel_ack",
"name": "Order Cancel Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "395",
"intl_id": "stamina_restored",
"name": "Stamina Restored",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "397",
"intl_id": "quest_res_ambush",
"name": "Quest result with Ambush",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "398",
"intl_id": "heal_up",
"name": "Heal Up",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "399",
"intl_id": "arena_fight_ack",
"name": "Arena Fight Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "400",
"intl_id": "go_arena_ack",
"name": "Go Arena Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "401",
"intl_id": "withdraw_nack",
"name": "Withdraw NAck",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "402",
"intl_id": "pillage_defeat",
"name": "Pillage Defeat",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "403",
"intl_id": "level_up_req",
"name": "Level Up Req",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "404",
"intl_id": "level_up_ack",
"name": "Level Up Ack",
"obj_type_id": "3"
"obj_type": "msg"
},
{
"id": "601",
"intl_id": "job_pillage",
"name": "Pillage job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "602",
"intl_id": "job_tribute",
"name": "Tribute job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "604",
"intl_id": "job_gwithdraw",
"name": "GWithdrawal job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "605",
"intl_id": "job_gstock",
"name": "GStock job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "606",
"intl_id": "job_rescan_msg",
"name": "Rescan message job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "607",
"intl_id": "job_set_done",
"name": "Set job as done job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "608",
"intl_id": "job_msg_client",
"name": "Send message via client",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "609",
"intl_id": "job_msg_refresh",
"name": "Refresh message from client",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "610",
"intl_id": "job_backup_export",
"name": "Export Backup",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "611",
"intl_id": "job_backup_import",
"name": "Import Backup",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "612",
"intl_id": "job_gdeposit",
"name": "GDeposit job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "613",
"intl_id": "job_gdeposit_fwd",
"name": "GDeposit Forward job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "614",
"intl_id": "job_save_res",
"name": "Save resources job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "615",
"intl_id": "job_vault_user_status",
"name": "Vault User Status job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "616",
"intl_id": "job_vault_item_status",
"name": "Vault Item Status job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "617",
"intl_id": "job_fwd_msg",
"name": "Forward Message job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "618",
"intl_id": "job_set_def",
"name": "Set Defense Job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "619",
"intl_id": "job_msg_del",
"name": "Msg Del Job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "620",
"intl_id": "job_get_hammer_time",
"name": "Get Hammer Time job",
"obj_type_id": "6"
"obj_type": "job"
},
{
"id": "701",
"intl_id": "item_res",
"name": "Time",
"obj_type_id": "7"
"name": "Resource",
"obj_type": "item"
},
{
"id": "702",
"intl_id": "item_alch",
"name": "Time",
"obj_type_id": "7"
"name": "Alchemy",
"obj_type": "item"
},
{
"id": "703",
"intl_id": "item_misc",
"name": "Time",
"obj_type_id": "7"
"name": "Miscellaneous",
"obj_type": "item"
},
{
"id": "704",
"intl_id": "item_recipe",
"name": "Time",
"obj_type_id": "7"
"name": "Recipe",
"obj_type": "item"
},
{
"id": "705",
"intl_id": "item_part",
"name": "Time",
"obj_type_id": "7"
"name": "Part",
"obj_type": "item"
},
{
"id": "706",
"intl_id": "item_other",
"name": "Time",
"obj_type_id": "7"
"name": "Other",
"obj_type": "item"
},
{
"id": "801",
"intl_id": "castle",
"name": "Castle",
"obj_type_id": "8"
"obj_type": "castle"
},
{
"id": "901",
"intl_id": "fair",
"name": "Fair",
"obj_type_id": "9"
"obj_type": "fair"
},
{
"id": "1001",
"intl_id": "union",
"name": "Union",
"obj_type_id": "10"
"obj_type": "union"
},
{
"id": "1101",
"intl_id": "tribute",
"name": "Tribute",
"obj_type_id": "11"
"obj_type": "tribute"
},
{
"id": "1201",
"intl_id": "xp",
"name": "Experience",
"obj_type_id": "12"
"obj_type": "xp"
},
{
"id": "1301",
"intl_id": "forest",
"name": "Forest",
"obj_type_id": "13"
"obj_type": "quest"
},
{
"id": "1302",
"intl_id": "swamp",
"name": "Swamp",
"obj_type_id": "13"
"obj_type": "quest"
},
{
"id": "1303",
"intl_id": "valley",
"name": "Valley",
"obj_type_id": "13"
"obj_type": "quest"
}
]

File diff suppressed because it is too large Load Diff

View File

@ -104,7 +104,7 @@
"names": ["Cord"],
"craft": {"cmd": "/craft_12",
"mana": "15",
"recipe":[{"item": "01", "quantity": "7"},
"items":[{"item": "01", "quantity": "7"},
{"item": "19", "quantity": "1"}]}
},
{
@ -2676,7 +2676,7 @@
"names": ["Bottle of Rage"],
"craft": {"cmd": "/brew_p03",
"mana": "30",
"recipe":[{"item": "63", "quantity": "2"},
"items":[{"item": "63", "quantity": "2"},
{"item": "43", "quantity": "1"},
{"item": "59", "quantity": "1"},
{"item": "52", "quantity": "1"}]}

21
def.go
View File

@ -87,12 +87,20 @@ type ChatWarsItem struct {
Code string `json:"code"`
Name string `json:"name"`
Weight int64 `json:"weight"`
Exchange bool `json:"exchange"`
Exchange string `json:"exchange"`
Auction bool `json:"auction"`
Craft
}
type ChatWarsItemCraft struct {
Command string `json:"cmd"`
Mana int64 `json:"mana"`
Items []ChatWarsItems `json:"items"`
}
type ChatWarsItems struct {
ItemID64 int64 `json:"item_id"`
Item string `json:"item"`
ItemID64 int64
Quantity int64 `json:"quantity"`
}
@ -280,10 +288,11 @@ type ChatWarsMessageTimeAck struct {
type MessageParsingRule struct {
ID int32
Priority int32
Description string
Rule string
MsgTypeID int64
Priority int32 `json:"prio"`
Description string `json:"descn"`
Rule string `json:"rule"`
MsgType string `json:"msg_type"`
MsgTypeID64 int64
ChatID64 int64
SenderUserID64 int64
re *regexp.Regexp

View File

@ -108,6 +108,7 @@ func resetObjItem() {
reloadObjItem(`57`, `Dragon Seed`, objSubTypeItemAlch, 1, true, false)
reloadObjItem(`58`, `Queen's Pepper`, objSubTypeItemAlch, 1, true, false)
reloadObjItem(`59`, `Plasma of Abyss`, objSubTypeItemAlch, 1, true, false)
reloadObjItem(`59`, `Plasma of abyss`, objSubTypeItemAlch, 1, true, false)
reloadObjItem(`60`, `Ultramarine Dust`, objSubTypeItemAlch, 1, true, false)
reloadObjItem(`61`, `Ethereal Bone`, objSubTypeItemAlch, 1, true, false)
reloadObjItem(`62`, `Itacory`, objSubTypeItemAlch, 1, true, false)

30
job.go
View File

@ -1358,22 +1358,24 @@ func jobGetHammerTime(j Job) {
} else {
out = `Perfect weather only for the next 2 hours.`
}
} else {
if hammerTimeNext(cwm.TimeOfDay, cwm.WeatherNext) ||
hammerTimeNext(cwm.TimeOfDay, cwm.Weather) {
out = `Perfect weather maybe in 2 hours.`
} else {
out = `No perfect weather in sight for the next 4 hours.`
c := TGCommand{
Type: commandSendMsg,
Text: out,
ToChatID64: cfg.Bot.Mainchat,
ParseMode: cmdParseModeHTML,
}
TGCmdQueue <- c
}
c := TGCommand{
Type: commandSendMsg,
Text: out,
ToChatID64: cfg.Bot.Mainchat,
ParseMode: cmdParseModeHTML,
}
TGCmdQueue <- c
/*
} else {
if hammerTimeNext(cwm.TimeOfDay, cwm.WeatherNext) ||
hammerTimeNext(cwm.TimeOfDay, cwm.Weather) {
out = `Perfect weather maybe in 2 hours.`
} else {
out = `No perfect weather in sight for the next 4 hours.`
}
}
*/
err = setJobDone(j.ID64)
logOnError(err, "jobGetHammerTime : setJobDone")

18
main.go
View File

@ -52,10 +52,10 @@ var (
config = flag.String("config", "chirpnest.cfg", "config file path")
initdb = flag.Bool("initdb", false, "initialize bot database")
db *sql.DB
b *tb.Bot
db *sql.DB
bot *tb.Bot
c *cron.Cron
cr *cron.Cron
cfg Config
@ -151,7 +151,7 @@ func main() {
logOnError(err, "Caching msgs")
// Registering bot
b, err := tb.NewBot(tb.Settings{
bot, err := tb.NewBot(tb.Settings{
Token: cfg.Telegram.Token,
URL: cfg.Telegram.URL,
Poller: &tb.LongPoller{Timeout: 10 * time.Second},
@ -159,16 +159,16 @@ func main() {
failOnError(err, "Registering bot")
log.Println("Bot registered")
log.Printf("URL : %s\n", b.URL)
log.Printf("Token : %s\n", b.Token)
log.Printf("URL : %s\n", bot.URL)
log.Printf("Token : %s\n", bot.Token)
go BotHandlers(b)
go BotHandlers(bot)
u := tb.User{
ID: int(cfg.Bot.Admin),
}
b.Send(&u, "Bot restarted")
bot.Send(&u, "Bot restarted")
c = startCron()
cr = startCron()
MQCWMsgQueue = make(chan ChatWarsMessage, MQCWMsgQueueSize)
SQLMsgIdentifyQueue = make(chan int64, SQLMsgIdentifyQueueSize)

View File

@ -5,12 +5,22 @@ import (
)
func resetMsgParsingRules2() error {
var rules
_, err := db.Exec(`TRUNCATE TABLE msg_rules;`)
failOnError(err, "resetMsgParsingRules2 : truncate table msg_rules")
logOnError(err, "resetMsgParsingRules2 : truncate table msg_rules")
if err != nil {
return err
}
b, err := Asset("data/msg_rules.json")
logOnError(err, "resetMsgParsingRules2 : load data/msg_rules.json")
if err != nil {
return err
}
rules := []MessageParsingRule{}
err = json.Unmarshal(b, &rules)
return nil
}

12
sql.go
View File

@ -577,12 +577,12 @@ func initDB() {
,(` + strconv.Itoa(objSubTypeJobSetDef) + `, "job_set_def", "Set Defense job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobMsgDel) + `, "job_msg_del", "Msg Del job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobGetHammerTime) + `, "job_get_hammer_time", "Get Hammer Time job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeItemResource) + `, "item_res", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemAlch) + `, "item_alch", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemMisc) + `, "item_misc", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemRecipe) + `, "item_recipe", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemPart) + `, "item_part", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemOther) + `, "item_other", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemResource) + `, "item_res", "Resource", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemAlch) + `, "item_alch", "Alchemy", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemMisc) + `, "item_misc", "Miscelaneous", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemRecipe) + `, "item_recipe", "Recipe", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemPart) + `, "item_part", "Part", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemOther) + `, "item_other", "Other", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeCastle) + `, "castle", "Castle", ` + strconv.Itoa(objTypeCastle) + `)
,(` + strconv.Itoa(objSubTypeUnion) + `, "union", "Union", ` + strconv.Itoa(objTypeUnion) + `)
,(` + strconv.Itoa(objSubTypeFair) + `, "fair", "Fair", ` + strconv.Itoa(objTypeFair) + `)