@@ -15,7 +15,7 @@ use self::serenity::{
1515use poise:: { serenity_prelude as serenity, CreateReply } ;
1616
1717use tts_core:: {
18- common:: dm_generic,
18+ common:: { dm_generic, safe_truncate } ,
1919 database,
2020 database_models:: Compact ,
2121 structs:: { Command , CommandResult , Context , PrefixContext , TTSModeChoice } ,
@@ -342,7 +342,7 @@ fn process_cache_info(
342342 Some ( fields)
343343}
344344
345- #[ poise:: command( prefix_command, owners_only) ]
345+ #[ poise:: command( prefix_command, owners_only, hide_in_help ) ]
346346pub async fn cache_info ( ctx : Context < ' _ > , kind : Option < String > ) -> CommandResult {
347347 ctx. defer ( ) . await ?;
348348
@@ -394,8 +394,12 @@ fn format_channels<'a>(channels: impl Iterator<Item = &'a serenity::GuildChannel
394394 let mut out = String :: new ( ) ;
395395 for channel in channels {
396396 writeln ! ( out, "`{}`: {}" , channel. id, channel. base. name) . unwrap ( ) ;
397+ if out. len ( ) >= 1024 {
398+ break ;
399+ }
397400 }
398401
402+ safe_truncate ( & mut out, 1024 ) ;
399403 out
400404}
401405
@@ -406,7 +410,7 @@ fn get_runner_channel(
406410 ctx. runners . get ( & shard_id) . map ( |entry| entry. 1 . clone ( ) )
407411}
408412
409- #[ poise:: command( prefix_command, owners_only) ]
413+ #[ poise:: command( prefix_command, owners_only, hide_in_help ) ]
410414pub async fn guild_info ( ctx : Context < ' _ > , guild_id : Option < serenity:: GuildId > ) -> CommandResult {
411415 let cache = ctx. cache ( ) ;
412416 let Some ( guild_id) = guild_id. or ( ctx. guild_id ( ) ) else {
@@ -423,7 +427,7 @@ pub async fn guild_info(ctx: Context<'_>, guild_id: Option<serenity::GuildId>) -
423427 . footer ( CreateEmbedFooter :: new ( & * footer) )
424428 . title ( & * title) ;
425429
426- let permissions_formatted;
430+ let mut permissions_formatted;
427431 let mut guild_cached = false ;
428432 if let Some ( guild) = cache. guild ( guild_id) {
429433 guild_cached = true ;
@@ -433,6 +437,7 @@ pub async fn guild_info(ctx: Context<'_>, guild_id: Option<serenity::GuildId>) -
433437 "Administrator"
434438 } else {
435439 permissions_formatted = permissions. to_string ( ) ;
440+ safe_truncate ( & mut permissions_formatted, 256 ) ;
436441 & permissions_formatted
437442 } ;
438443
0 commit comments