@@ -87,6 +87,7 @@ def get_pointer(obj: typing.Union[discord.Guild, int]):
87
87
for p in pointers :
88
88
if p .guild .id == obj .id :
89
89
return p
90
+ pointers .append (Pointer (obj ))
90
91
return get_pointer (obj )
91
92
92
93
elif isinstance (obj , int ):
@@ -126,6 +127,18 @@ def arrow_button():
126
127
return discord .Button (style = discord .ButtonStyle .Primary )
127
128
128
129
130
+ @client .command (name = "start_game" )
131
+ async def start_game (ctx : commands .Context ):
132
+ pointer : Pointer = get_pointer (ctx .guild )
133
+ await ctx .send (embed = discord .Embed (title = "Little Game" ,
134
+ description = self .display (x = 0 , y = 0 )),
135
+ components = [discord .ActionRow (self .empty_button , self .arrow_button .set_label ('↑' ).set_custom_id ('up' ), self .empty_button ),
136
+ discord .ActionRow (self .arrow_button .set_label ('←' ).set_custom_id ('left' ).disable_if (pointer .possition_x <= 0 ), self .arrow_button .set_label ('↓' ).set_custom_id ('down' ).disable_if (pointer .possition_y <= 0 ), self .arrow_button .set_label ('→' ).set_custom_id ('right' ))
137
+ ]
138
+ )
139
+
140
+
141
+ @client .event
129
142
async def on_raw_interaction_create (interaction : discord .RawInteractionCreateEvent ):
130
143
await interaction .defer ()
131
144
pointer : Pointer = get_pointer (interaction .guild )
@@ -164,4 +177,4 @@ async def on_raw_interaction_create(interaction: discord.RawInteractionCreateEve
164
177
discord .ActionRow (arrow_button .set_label ('←' ).set_custom_id ('left' ).disable_if (pointer .possition_x <= 0 ), arrow_button .set_label ('↓' ).set_custom_id ('down' ), arrow_button .set_label ('→' ).set_custom_id ('right' ))]
165
178
)
166
179
167
- client .run ('You Bot-Token here' )
180
+ client .run ('You Bot-Token here' )
0 commit comments