CARVIEW |
Select Language
HTTP/2 200
date: Wed, 23 Jul 2025 21:54:58 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"0bfcdf74ba0a0c1860ea583d8e86672c"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=yLENLHuqeveay91ZsSTNPGxnGe9%2BdQLOoEcNuqGwgmC4kQlGHGigD6Y06jLKm0d%2F6YbuLPxnppgDoBa5tREnnfLQVq0f2ZVCj%2Bs4FZLLLDuFUTcZ1QFHvEI1K3li%2BmE9ZJJfsa%2B8IJapoh3GZWUgG%2Fz5b%2F8LXB7apbi1PRHUGA%2BpWxdRywJ3YkyGFk%2FO%2F7nx4rj5jk8pcxA7supuRKwWjUPum%2BiaK7Tm0xl9uGmJq3PVKcFb8Ex7Cy35Y9%2FRXWxOVMlaRerADDRrwo2MloFW%2BQ%3D%3D--bWxNjElk5wMolyjJ--4twT%2F31IgF%2BD45UIvnV7Uw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.755989436.1753307697; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 21:54:57 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 21:54:57 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 9186:271430:11002ED:144E09D:68815A31
qqbot 的 demo:在控制台打印接收到的所有消息 · GitHub
Show Gist options
Save ScienJus/f1ba1e5b1611cca662cc to your computer and use it in GitHub Desktop.
{{ message }}
Instantly share code, notes, and snippets.
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save ScienJus/f1ba1e5b1611cca662cc to your computer and use it in GitHub Desktop.
qqbot 的 demo:在控制台打印接收到的所有消息
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'qqbot' | |
class MyBot | |
def initialize | |
@qqbot = QQBot.new | |
sleep 2 | |
@friend_name_map = {} | |
@qqbot.get_friend_list.each { |friend| @friend_name_map[friend.id] = friend.markname || friend.nickname } | |
sleep 2 | |
@group_name_map = {} | |
@group_code_map = {} | |
@qqbot.get_group_list.each do |group| | |
@group_name_map[group.id] = group.markname || group.name | |
@group_code_map[group.id] = group.code | |
end | |
sleep 2 | |
@discuss_name_map = {} | |
@qqbot.get_discuss_list.each { |discuss| @discuss_name_map[discuss.id] = discuss.name } | |
sleep 2 | |
@group_member_name_map = {} | |
@discuss_member_name_map = {} | |
@qq_map = {} | |
end | |
def init_group_member_name_map(group_id) | |
unless @group_member_name_map[group_id] | |
@group_member_name_map[group_id] = {} | |
group_code = @group_code_map[group_id] | |
@qqbot.get_group_info(group_code).members.each { |member| @group_member_name_map[group_id][member.id] = @friend_name_map[member.id] || member.markname || member.nickname } | |
end | |
end | |
def init_discuss_member_name_map(discuss_id) | |
unless @discuss_member_name_map[discuss_id] | |
@discuss_member_name_map[discuss_id] = {} | |
@qqbot.get_discuss_info(discuss.id).members.each { |member| @discuss_member_name_map[discuss_id][member.id] = @friend_name_map[member.id] || member.nickname } | |
end | |
end | |
def init_qq_map(id) | |
unless @qq_map[id] | |
@qq_map[id] = @qqbot.get_qq_by_id(id) | |
end | |
end | |
def run | |
@qqbot.poll do |message| | |
init_qq_map(message.send_id) | |
if message.type == 0 | |
puts "#{@friend_name_map[message.from_id]}(#{@qq_map[message.from_id]}) 对你说:#{message.content}" | |
elsif message.type == 1 | |
init_group_member_name_map message.from_id | |
puts "群 #{@group_name_map[message.from_id]} 的 #{@group_member_name_map[message.from_id][message.send_id]}(#{@qq_map[message.send_id]}) 说:#{message.content}" | |
elsif message.type == 2 | |
init_discuss_member_name_map message.from_id | |
puts "讨论组 #{@discuss_name_map[message.from_id]} 的 #{@discuss_member_name_map[message.from_id][message.send_id]}(#{@qq_map[message.send_id]}) 说:#{message.content}" | |
end | |
end | |
end | |
end | |
mybot = MyBot.new | |
mybot.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t perform that action at this time.