channel.fetchMessages()
.then(messages => messages.array.forEach(
message => message.author.equals(client.user) && message.delete()
));
尝试执行此操作以从TextChannel channel
中删除我的机器人已发送的所有邮件。
不起作用,错误:
messages.array.forEach
不是函数
如何让机器人删除机器人发送到特定频道的所有邮件?
答案 0 :(得分:0)
您的问题是I had same kind of issue when i tried to print Ref_cursor directly. Then i created a Record type variable and then fetched field values in that variable and then i used DBMS_OUTPUT for that record type variable.
Please see if below code and scenario can help you-
set serveroutput on;
declare
v_sql varchar2(1000);
v_cursor sys_refcursor;
type myrec is record(col1 varchar2(100),col2 varchar2(1000));
rec myrec;
begin
v_sql:='select name,status from t_employee where user_id in (''C001117'',''C001122'')';
open v_cursor for v_sql;
loop
fetch v_cursor
into rec;
exit when v_cursor%notfound;
dbms_output.put_line( rec.col1||':status '||rec.col2 );
end loop;
end;
/
是一个函数,而不仅仅是.array
集合上的属性。不使用messages
,而是使用.array
。这是代码中的修复:
.array()