File tree Expand file tree Collapse file tree
plugins/Automod/functions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,11 +121,11 @@ export class GuildSavedMessages extends BaseGuildRepository<SavedMessage> {
121121
122122 if ( msg . poll ) {
123123 data . poll = {
124+ question : msg . poll . question ,
124125 answers : Array . from ( msg . poll . answers . values ( ) ) . map ( ( answer ) => ( {
125126 id : answer . id ,
126127 text : answer . text ,
127128 } ) ) ,
128- question : msg . poll . question ,
129129 } ;
130130 }
131131
Original file line number Diff line number Diff line change @@ -65,13 +65,13 @@ export interface ISavedMessageStickerData {
6565}
6666
6767export interface ISavedMessagePollData {
68+ question : {
69+ text : string ;
70+ } ;
6871 answers : {
6972 id : number ;
7073 text : string | null ;
7174 } [ ] ;
72- question : {
73- text : string ;
74- } ;
7575}
7676
7777export interface ISavedMessageData {
Original file line number Diff line number Diff line change @@ -30,5 +30,10 @@ export function getTextMatchPartialSummary(
3030 return `visible name: ${ visibleName } ` ;
3131 } else if ( type === "customstatus" ) {
3232 return `custom status: ${ context . member ! . presence ?. activities . find ( ( a ) => a . type === ActivityType . Custom ) ?. name } ` ;
33+ } else if ( type == "poll" ) {
34+ const message = context . message ! ;
35+ const channel = pluginData . guild . channels . cache . get ( message . channel_id as Snowflake ) ;
36+ const channelMention = channel ? verboseChannelMention ( channel ) : `\`#${ message . channel_id } \`` ;
37+ return `poll in ${ channelMention } :\n${ messageSummary ( message ) } ` ;
3338 }
3439}
Original file line number Diff line number Diff line change @@ -15,14 +15,7 @@ type TextTriggerWithMultipleMatchTypes = {
1515 match_polls : boolean ;
1616} ;
1717
18- export type MatchableTextType =
19- | "message"
20- | "embed"
21- | "visiblename"
22- | "username"
23- | "nickname"
24- | "customstatus"
25- | "polls" ;
18+ export type MatchableTextType = "message" | "embed" | "visiblename" | "username" | "nickname" | "customstatus" | "poll" ;
2619
2720type YieldedContent = [ MatchableTextType , string ] ;
2821
@@ -69,6 +62,6 @@ export async function* matchMultipleTextTypesOnMessage(
6962 }
7063
7164 if ( trigger . match_polls && msg . data . poll ) {
72- yield [ "polls " , JSON . stringify ( msg . data . poll ) ] ;
65+ yield [ "poll " , JSON . stringify ( msg . data . poll ) ] ;
7366 }
7467}
Original file line number Diff line number Diff line change @@ -1326,6 +1326,10 @@ export function messageSummary(msg: SavedMessage) {
13261326 "\n" ;
13271327 }
13281328
1329+ if ( msg . data . poll ) {
1330+ result += "Poll: ```" + escapeCodeBlock ( JSON . stringify ( msg . data . poll ) ) + "```" ;
1331+ }
1332+
13291333 return result ;
13301334}
13311335
You can’t perform that action at this time.
0 commit comments