小编Sun*_*Bro的帖子

使用“npm”时,它需要我登录到 github

问题当我尝试以npm任何方式使用时,例如:npm update或者npm i package它立即给我一个 github 登录提示。

我尝试将 npm 与i,一起使用,install甚至直接给它 git git://。但没有一个工作可悲。

我是 Node.js 的新手。到目前为止(2 周),我一直在更新、安装和重新安装依赖项,没有任何问题。刚刚出现这个问题。

在错误发生之前我在做什么没什么特别的。只是编程。我使用 npm 的最后一件事是安装 discord.js npm i discord.js

资产:

操作系统:Windows 10 64位

Node.js 版本:8.10.0

Node.js 安装方法:通过站点 [Gui]

登录或按取消后,我不断收到 git 提示和错误

Git登录提示 在此处输入图片说明

在此处输入图片说明

node.js npm discord.js

4
推荐指数
2
解决办法
4495
查看次数

验证几个变量的值

我所追求的:允许用户仅输入0或1(总共4个变量).如果用户输入例如2,1,1,0,则应该抛出错误说明Only 0 and 1 allowed.

到目前为止我尝试过的:

if (firstBinary != 0 or firstBinary != 1 and secondBinary != 0
      or secondBinary != 1 and thirdBinary != 0 or thirdBinary != 1
      and forthBinary != 0 or forthBinary != 1):
    print('Only 0 and 1 allowed')
else:
    print('binary to base 10: result)
Run Code Online (Sandbox Code Playgroud)

问题:当我使用这样的语句时,即使我输入例如5,我也得到结果,或者即使我写了全部1或0,我也得到"只允许0和1".


我发现这似乎是我所追求的,但它仍然没有像我想要的那样工作:

if 0 in {firstBinary, secondBinary, thirdBinary, forthBinary} or 1 in \
    {firstBinary, secondBinary, thirdBinary, forthBinary}:
    print("Your result for binary to Base 10: ", allBinaries)
else: …
Run Code Online (Sandbox Code Playgroud)

python

3
推荐指数
1
解决办法
64
查看次数

未定义成员.voiceChannel

我的不和谐机器人遇到问题,不知道用户所在的频道。如果我检查member.voiceChannel它总是返回undefined. 即使我在语音频道内。

代码:

let voiceChannel;

voiceChannel = msg.member.voiceChannel;

if (!voiceChannel) {   
    return msg.reply('Please join a voice channel before using this command.');
}
Run Code Online (Sandbox Code Playgroud)

console.log(voiceChannel);undefined无论我是否在语音频道中,都会打印。

javascript bots node.js discord discord.js

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

discord.js ×2

node.js ×2

bots ×1

discord ×1

javascript ×1

npm ×1

python ×1