Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining chatType to not be a channel does not guarantee ctx.msg.from #252

Closed
C0rn3j opened this issue Jul 31, 2022 · 6 comments · Fixed by #253
Closed

Defining chatType to not be a channel does not guarantee ctx.msg.from #252

C0rn3j opened this issue Jul 31, 2022 · 6 comments · Fixed by #253

Comments

@C0rn3j
Copy link
Contributor

C0rn3j commented Jul 31, 2022

image

I should not have to do the undefined check for this to work on Deno with TS.

bot.chatType(['private','group','supergroup']).command('test', async (ctx) => {
	if (ctx.message === undefined) {
		return
	}
	const userID = ctx.msg.from.id
@KnorpelSenf
Copy link
Member

Can you reproduce this on Deno?

@C0rn3j
Copy link
Contributor Author

C0rn3j commented Aug 1, 2022

Actually no, Deno itself runs the project fine with no errors/warnings, its just VSC that's complaining

@KnorpelSenf
Copy link
Member

Sorry, I misread. I thought you had said it was on Node. That's why I was asking if it's Node-only.

Are you saying now that the code typechecks with deno check but not in the editor?

@C0rn3j
Copy link
Contributor Author

C0rn3j commented Aug 1, 2022

Sorry for being confusing, deno check fails, but the project runs anyways... I was kind of expecting Deno to error out and not let me proceed.

@KnorpelSenf
Copy link
Member

I understand. Can you show the output of deno --version? I think then I'll have enough information to be able to investigate further

@C0rn3j
Copy link
Contributor Author

C0rn3j commented Aug 1, 2022

 % deno --version                                                                                            
deno 1.24.1 (release, x86_64-unknown-linux-gnu)
v8 10.4.132.20
typescript 4.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants