Skip to content

Commit

Permalink
Hashtags for categories
Browse files Browse the repository at this point in the history
  • Loading branch information
Shape6253 authored and bostrot committed Mar 3, 2023
1 parent 3439ff2 commit a41de60
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/config-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ autoreply:
# - name: "Admin Chat"
# group_id: "-12345678910"
# - name: "Other issues"
# tag: "#other"
# msg: "Please specify your order number and describe the problem in as much detail as possible"
# group_id: "-12345678910"
# - name: "Contact"
Expand Down
1 change: 1 addition & 0 deletions src/addons/telegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class TelegramAddon {
modeData: {} as any,
mode: null,
groupCategory: null,
groupTag: '',
group: '',
groupAdmin: {} as any,
getSessionKey: (ctx: Context) => {
Expand Down
2 changes: 2 additions & 0 deletions src/inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function initInline(bot: TelegramAddon) {
);
}
ctx.session.group = cache.config.categories[i].group_id;
ctx.session.groupTag = cache.config.categories[i].tag || '';
ctx.session.groupCategory = cache.config.categories[i].name;
});
// Create subcategory button events
Expand All @@ -87,6 +88,7 @@ function initInline(bot: TelegramAddon) {
);
}
ctx.session.group = cache.config.categories[i].group_id;
ctx.session.groupTag = cache.config.categories[i].tag || '';
ctx.session.groupCategory = cache.config.categories[i].name;
});
continue;
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface SessionData {
mode: string | null;
modeData: ModeData;
groupCategory: string | null;
groupTag: string;
group: string;
groupAdmin: any;
getSessionKey: Function;
Expand Down Expand Up @@ -72,6 +73,7 @@ interface Language {
interface Category {
name: string;
msg: string;
tag: string;
group_id: string;
subgroups: {
name: string;
Expand Down
8 changes: 7 additions & 1 deletion src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function ticketMsg(
from: { first_name: string | any[]; language_code: any };
text: string | any[];
},
tag: string,
anon = true,
autoReplyInfo: any,
) {
Expand All @@ -29,7 +30,7 @@ function ticketMsg(
`#T${ticket.toString().padStart(6, '0')} ${cache.config.language.from} ` +
`[${esc(message.from.first_name)}](${link})` +
` ${cache.config.language.language}: ` +
`${message.from.language_code}\n\n` +
`${message.from.language_code} ${tag}\n\n` +
`${esc(message.text)}\n\n` +
(autoReplyInfo ? `_${autoReplyInfo}_` : '')
);
Expand Down Expand Up @@ -109,6 +110,7 @@ function chat(ctx: Context, chat: { id: string }) {
ticketMsg(
ticket.id,
ctx.message,
ctx.session.groupTag,
cache.config.anonymous_tickets,
autoReplyInfo,
),
Expand All @@ -126,6 +128,7 @@ function chat(ctx: Context, chat: { id: string }) {
ticketMsg(
ticket.id,
ctx.message,
ctx.session.groupTag,
cache.config.anonymous_tickets,
autoReplyInfo,
),
Expand Down Expand Up @@ -175,6 +178,7 @@ function chat(ctx: Context, chat: { id: string }) {
ticketMsg(
ticket.id,
ctx.message,
ctx.session.groupTag,
cache.config.anonymous_tickets,
autoReplyInfo,
),
Expand All @@ -189,6 +193,7 @@ function chat(ctx: Context, chat: { id: string }) {
ticketMsg(
ticket.id,
ctx.message,
ctx.session.groupTag,
cache.config.anonymous_tickets,
autoReplyInfo,
),
Expand All @@ -213,6 +218,7 @@ function chat(ctx: Context, chat: { id: string }) {
ticketMsg(
ticket.id,
ctx.message,
ctx.session.groupTag,
cache.config.anonymous_tickets,
autoReplyInfo,
),
Expand Down

0 comments on commit a41de60

Please sign in to comment.