From: CMDR furrycat Date: Sat, 15 Apr 2017 20:57:10 +0000 (+0100) Subject: Save faction ID in factions table. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=88c4819922ec250c4535c4708c371e5cb3f2576e;p=furrycat%2Fcatbot.git Save faction ID in factions table. --- diff --git a/plugin/faction/faction.py b/plugin/faction/faction.py index 128fbae..0c31be7 100644 --- a/plugin/faction/faction.py +++ b/plugin/faction/faction.py @@ -47,7 +47,7 @@ class Faction(DBConnection): def create_tables(self): self.open_db() - cursor = self.query('create table if not exists factions (id char(36) not null, bot_id varchar(32) not null, member_id varchar(32) not null, server_id varchar(32) not null, channel_id varchar(32) not null, newsflash_channel_id varchar(32), name varchar(128) not null, state_id int not null, interval int not null default 86400, updated datetime)') + cursor = self.query('create table if not exists factions (id char(36) not null, bot_id varchar(32) not null, member_id varchar(32) not null, server_id varchar(32) not null, channel_id varchar(32) not null, newsflash_channel_id varchar(32), faction_id int not null, name varchar(128) not null, state_id int not null, interval int not null default 86400, updated datetime)') cursor = self.query('create unique index if not exists factions_id on factions (id)') cursor = self.query('create index if not exists factions_bot_id on factions (bot_id)') cursor = self.query('create table if not exists faction_names (faction_id int not null, name varchar(128) not null)') @@ -310,7 +310,7 @@ class Faction(DBConnection): if len(lines): await bot.say_many(message.channel, lines) for tracked in self.tracked_factions: - await self.report_stale_influence(message.channel, name = tracked.name) + await self.report_stale_influence(message.channel, id = tracked.faction_id) async def list_tracked_factions(self, message): results = [] @@ -471,8 +471,8 @@ class Faction(DBConnection): log.warning("Can't get channel for faction {}".format(tracked.id)) self.update_tracked_faction(tracked.id, **update) - await self.report_faction_influence(channel, name = tracked.name, yelp_if_no_data = False) - await self.report_stale_influence(channel, name = tracked.name) + await self.report_faction_influence(channel, id = tracked.faction_id, yelp_if_no_data = False) + await self.report_stale_influence(channel, id = tracked.faction_id) async def get_faction(self, destination, name): factions = eddb.find_faction(name)