Warning: session_start(): open(/var/lib/php/sessions/sess_nat1d3bf4q3pud5df9qckm7pga, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
concept User {
long userID;
S name;
toString { ret name; }
}
concept Channel {
long channelID;
S name;
toString { ret name; }
}
sclass Reaction {
long created;
User user;
S emoji;
toString { ret emoji + " (" + user + ")"; }
}
concept Line {
long msgID;
bool bot, isPrivate;
Channel channel;
User author;
S text;
new L reactions;
}
cmodule GLines > DynCRUD {
// API
User uniqUser(long userID) {
ret uniq_sync User(+userID);
}
Channel uniqChannel(long channelID) {
ret uniq_sync Channel(+channelID);
}
Reaction nuReaction(O... params) {
ret nu Reaction(params);
}
long getChannelID(S name) {
ret getLongOrZero channelID(conceptWhere Channel(name := dropPrefix("#", name)));
}
Line lastLineInChannel(long channelID) {
Channel channel = conceptWhere Channel(+channelID);
if (channel == null) null;
ret last(conceptsWhere Line(+channel));
}
Line nextToLastLineInChannel(long channelID) {
Channel channel = conceptWhere Channel(+channelID);
if (channel == null) null;
ret nextToLast(conceptsWhere Line(+channel));
}
L linesInChannelBy(long channelID, long userID) {
Channel channel = conceptWhere Channel(+channelID);
if (channel == null) null;
User user = conceptWhere User(+userID);
if (user == null) null;
ret conceptsWhere Line(+channel, author := user);
}
L linesInChannel(long channelID) {
Channel channel = conceptWhere Channel(+channelID);
if (channel == null) null;
ret conceptsWhere Line(+channel);
}
long idForChannel(S name) {
ret getChannelID(name);
}
// attention: Discord user names may change
long idForUser(S name) {
ret getLong userID(conceptWhere User(+name));
}
int monologueLength(long channelID) {
L lines = linesInChannel(channelID);
int n = 0;
while (n < l(lines) && lines.get(l(lines)-1-n).bot) ++n;
ret n;
}
Line lineForID(long msgID) {
ret conceptWhere Line(+msgID);
}
}